Skip to content

Instantly share code, notes, and snippets.

@robhinds
Last active December 24, 2015 18:49
Show Gist options
  • Save robhinds/6845572 to your computer and use it in GitHub Desktop.
Save robhinds/6845572 to your computer and use it in GitHub Desktop.
def factorial ={ n, accumulator=1 ->
if (n == 1) accumulator
else factorial(n-1, n*accumulator)
}
factorial(4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment