Last active
July 22, 2017 06:38
-
-
Save jutikorn/451a6d68f455293f37155da9c6f95381 to your computer and use it in GitHub Desktop.
factorial
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
fun factorial(num: Double): Double { | |
when (num) { | |
1.0 -> | |
return num | |
else -> | |
return factorial(num - 1) * num | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment