Skip to content

Instantly share code, notes, and snippets.

@tarynsauer
Last active December 19, 2015 03:58
Show Gist options
  • Save tarynsauer/5893788 to your computer and use it in GitHub Desktop.
Save tarynsauer/5893788 to your computer and use it in GitHub Desktop.
Factorial with reduce enumerator
def factorial(n)
(1..n).reduce(1, :*)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment