Skip to content

Instantly share code, notes, and snippets.

@dscataglini
Created August 26, 2013 19:59
Show Gist options
  • Save dscataglini/6345933 to your computer and use it in GitHub Desktop.
Save dscataglini/6345933 to your computer and use it in GitHub Desktop.
Factorial
# write a recursive function that brings back a factorial
#
# How does factorial work:
# 0! = 1 #=> 1
# 1! = 1 #=> 1
# 2! = 2 * 1 #=> 2
# 3! = 3 * 2 * 1 #=> 6
# 4! = 4 * 3 * 2 * 1 #=> 24
# 5! = 5 * 4 * 3 * 2 * 1 #=> 120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment