lollospadalaser
New Coder
i have an easy question, i don't understand why this works:
and this one not:
i don't understand the difference, why declaring it first make it works? If i remove the local they both works as expected
Code:
local fact
fact= function (n)
if n == 0 then return 1
else return n*fact(n-1)
end
end
print(fact(4))
and this one not:
Code:
local fact = function (n)
if n == 0 then return 1
else return n*fact(n-1)
end
end
print(fact(4))
i don't understand the difference, why declaring it first make it works? If i remove the local they both works as expected