mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-27 09:15:50 +03:00
Recursive function a little bit to recursive
Infinitely recursive
This commit is contained in:
parent
8e723a5f45
commit
b2cb538a5a
@ -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…
Reference in New Issue
Block a user