7 lines
410 B
Lua
7 lines
410 B
Lua
x = acc(1) -- x stores the product with initial value = 1
|
|
x(5) -- add 5 to x's sum
|
|
acc(3) -- add 3 to factory's sum
|
|
print (x(2.3)) --> 8.3 -- add 2.3 to x's sum then print the result
|
|
y = acc() -- create new function with factory's sum as initial value
|
|
print (y()) --> 4 -- print the accumulated value inside the product y
|