Skip to content

Instantly share code, notes, and snippets.

@tatey
Created July 21, 2009 12:26
Show Gist options
  • Save tatey/151316 to your computer and use it in GitHub Desktop.
Save tatey/151316 to your computer and use it in GitHub Desktop.
Factorial in Ruby
def factorial(count, sum = 1)
count.zero? ? sum : factorial(count - 1, sum * count)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment