Skip to content

Instantly share code, notes, and snippets.

@poppingtonic
Forked from viebel/factorial.lua
Created March 19, 2017 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save poppingtonic/5b76877ee42b95e009fac2f42774c0ef to your computer and use it in GitHub Desktop.
Save poppingtonic/5b76877ee42b95e009fac2f42774c0ef to your computer and use it in GitHub Desktop.
-- defines a factorial function
function fact (n)
if n <= 0 then
return 1
else
return n * fact(n-1)
end
end
print(fact(5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment