Skip to content

Instantly share code, notes, and snippets.

@ilyarmnzhdn
Created November 1, 2017 08:17
Show Gist options
  • Save ilyarmnzhdn/9ed816afeb57babddcf999c132256b1d to your computer and use it in GitHub Desktop.
Save ilyarmnzhdn/9ed816afeb57babddcf999c132256b1d to your computer and use it in GitHub Desktop.
Factorialize Int using recursion (Swift)
func factorialize(number: Int) -> Int {
if (number == 0) { return 1 }
return (number * factorialize(number: number - 1))
}
factorialize(number: 6)
@ilyarmnzhdn
Copy link
Author

ToDo:
Make it for all types. (Add generics)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment