1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-07-31 12:00:34 +02:00

Merge pull request #811 from OscarF/patch-1

Recursive function a little bit to recursive
This commit is contained in:
Levi Bostian
2014-10-17 22:51:33 -05:00

View File

@@ -93,7 +93,7 @@ let inc_int (x: int) : int = x + 1 ;;
(* You need to mark recursive function definitions as such with "rec" keyword. *)
let rec factorial n =
if n = 0 then 1
else factorial n * factorial (n-1)
else n * factorial (n-1)
;;
(* Function application usually doesn't need parentheses around arguments *)