Scope in reduce

use global:

c=2
function ad(a,b)
    global c=c*c
    return a+b+c
end

this will change the value of c, if you don’t want to change it, use another variable name
also use ``` to display nice code here

1 Like