Files
grokking_algorithms/03_recursion/lua/03_factorial.lua
2017-08-27 14:25:58 -04:00

9 lines
120 B
Lua

function fact(x)
if x <= 1 then
return 1
else
return x * fact(x - 1)
end
end
print(fact(5))