Created
December 6, 2015 13:17
-
-
Save vlad-bezden/608d2036d71badf1991d to your computer and use it in GitHub Desktop.
Factorial implementation in F# using pattern matching
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
let rec factorial n = | |
match n with | |
| 0 | 1 -> 1 | |
| _ -> n * factorial(n - 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment