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:
commit
89fa5e0dab
@ -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 *)
|
||||
|
Loading…
x
Reference in New Issue
Block a user