|
|
|
|
|
by p4bl0
4256 days ago
|
|
if <expr1> then <expr2.1>;<expr2.2> else <expr3>
Actually, this will not work, I was also confused by it. # if true then (); 1 else 2;;
Error: Parse error: [str_item] or ";;" expected (in [top_phrase])
# if true then begin (); 1 end else 2;;
- : int = 1
# if true then ((); 1) else 2;;
- : int = 1
The confusion comes from the fact that it doesn't behave the same way in match expressions: # match true with | true -> (); 1 | false -> 2;;
- : int = 1
|
|