Skip to content

Instantly share code, notes, and snippets.

@lin
Created October 4, 2015 20:53
Show Gist options
  • Select an option

  • Save lin/2d6ad576a7452b8051af to your computer and use it in GitHub Desktop.

Select an option

Save lin/2d6ad576a7452b8051af to your computer and use it in GitHub Desktop.
function factorial (n){
if (n==0 || n==1){
return 1;
}
return factorial(n-1)*n;
}
//sweet
factorial = n ->
return 1 if n == 0 || 1
return factorial(n - 1) * n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment