aboutsummaryrefslogtreecommitdiff
path: root/comparison/OCaml/fib38.ml
diff options
context:
space:
mode:
Diffstat (limited to 'comparison/OCaml/fib38.ml')
-rw-r--r--comparison/OCaml/fib38.ml7
1 files changed, 7 insertions, 0 deletions
diff --git a/comparison/OCaml/fib38.ml b/comparison/OCaml/fib38.ml
new file mode 100644
index 0000000..2f7906d
--- /dev/null
+++ b/comparison/OCaml/fib38.ml
@@ -0,0 +1,7 @@
+let rec fib n =
+ match n with
+ 0 -> 0
+ | 1 -> 1
+ | n -> fib(n-1) + fib (n-2)
+
+let () = print_int (fib 38);