Skip to content

Instantly share code, notes, and snippets.

@BooneTeam
Created July 3, 2013 18:51
Show Gist options
  • Save BooneTeam/5921637 to your computer and use it in GitHub Desktop.
Save BooneTeam/5921637 to your computer and use it in GitHub Desktop.
Recursive Factorial Solution
def factorial_recursion(n, factorial = 1)
return factorial if n == 1
factorial *= (n)
factorial(n-1, factorial)
end
puts factorial_recursion(5)
#Run it at CodePad.org
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment