Skip to content

Instantly share code, notes, and snippets.

@chrisbodhi
Created July 15, 2016 03:08
Show Gist options
  • Select an option

  • Save chrisbodhi/53b33aa47e4202d2facd84eb5057d388 to your computer and use it in GitHub Desktop.

Select an option

Save chrisbodhi/53b33aa47e4202d2facd84eb5057d388 to your computer and use it in GitHub Desktop.
"Recursion is the GOTO of functional programming." -- Erik Meijer
def factorial n
(1..n).reduce{ |x, y| x * y }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment