Skip to content

Instantly share code, notes, and snippets.

@Ball
Created November 15, 2009 21:05
Show Gist options
  • Save Ball/235456 to your computer and use it in GitHub Desktop.
Save Ball/235456 to your computer and use it in GitHub Desktop.
let fibonacci n =
let rec loop current a b =
if current == n
then a + b
else loop (current+1) b (a+b)
match n with
| 0 -> 0
| 1 -> 1
| _ -> loop 2 0 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment