18 lines
320 B
Text
18 lines
320 B
Text
class box
|
|
function __construct(public v) end
|
|
end
|
|
|
|
local i = new box(0) -- any initial value will do here
|
|
|
|
local function sum(b, lo, hi, term)
|
|
local temp = 0
|
|
b.v = lo
|
|
while b.v <= hi do
|
|
temp += term()
|
|
b.v += 1
|
|
end
|
|
return temp
|
|
end
|
|
|
|
local s = sum(i, 1, 100, || -> 1 / i.v)
|
|
print(s)
|