Skip to content

Instantly share code, notes, and snippets.

@yusuiked
Created November 6, 2011 13:17
Show Gist options
  • Save yusuiked/1342862 to your computer and use it in GitHub Desktop.
Save yusuiked/1342862 to your computer and use it in GitHub Desktop.
Factorial using recursion in the Groovy language.
def fact(n) {n<=1?1:fact(n-1)*n}
assert [1,1,2,6,24,120,720,5040,40320,362880,3628800] == (0..10).collect {fact(it)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment