Skip to content

Instantly share code, notes, and snippets.

@vlad-bezden
Created December 6, 2015 13:17
Show Gist options
  • Save vlad-bezden/608d2036d71badf1991d to your computer and use it in GitHub Desktop.
Save vlad-bezden/608d2036d71badf1991d to your computer and use it in GitHub Desktop.
Factorial implementation in F# using pattern matching
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