1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-04-02 13:32:53 +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
commit 89fa5e0dab

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 *)