Skip to content

Instantly share code, notes, and snippets.

@felipernb
Created October 6, 2012 19:56
Show Gist options
  • Save felipernb/3845937 to your computer and use it in GitHub Desktop.
Save felipernb/3845937 to your computer and use it in GitHub Desktop.
Factorial in Go
func factorial(n int) int64 {
fact := int64(1)
for i := int64(n); i > 0; i-- { fact *= i }
return fact
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment