Skip to content

Instantly share code, notes, and snippets.

@stevencurtis
Created February 4, 2019 10:13
Show Gist options
  • Save stevencurtis/33bf1be7d2873d2cf1508b3d1522dec9 to your computer and use it in GitHub Desktop.
Save stevencurtis/33bf1be7d2873d2cf1508b3d1522dec9 to your computer and use it in GitHub Desktop.
Factorial Iterative
func fact (_ num : Int) -> Int {
if num == 1 {return 1}
var result = 1
for i in 1...num {
result = result * i
}
return result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment