Skip to content

Instantly share code, notes, and snippets.

@IndianGuru
Created August 26, 2011 03:58
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 IndianGuru/1172658 to your computer and use it in GitHub Desktop.
Save IndianGuru/1172658 to your computer and use it in GitHub Desktop.
Sample 1
def factorial(n)
(1..n).inject(1) { |product, value| product * value }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment