Created
November 1, 2017 08:17
-
-
Save ilyarmnzhdn/9ed816afeb57babddcf999c132256b1d to your computer and use it in GitHub Desktop.
Factorialize Int using recursion (Swift)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func factorialize(number: Int) -> Int { | |
if (number == 0) { return 1 } | |
return (number * factorialize(number: number - 1)) | |
} | |
factorialize(number: 6) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ToDo:
Make it for all types. (Add generics)