Skip to content

Instantly share code, notes, and snippets.

@bitops
Created January 7, 2012 05:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bitops/1573882 to your computer and use it in GitHub Desktop.
Save bitops/1573882 to your computer and use it in GitHub Desktop.
Factorial in Ruby 1.9.2
def factorial(n)
(1..n).reduce(:*)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment