I am trying to teach myself OCaml. I've been going nuts over this one syntax trap. I'm told that you can string expressions together in sequence using ";" ie, expr1 ; expr2 executes the first expr, then the second, as expected. For some reason, I cannot get the interpreter to agree with the following input
let x = 5 ; let y = 7;;
Bizarrely if ONLY the first expr is a let, it works. So
let x = 5 ; 7;;
Passes, and evaluates to 7. Even worse, if I attempt to use parens to compose multiple sequences of statements where the let comes first, it still does not work. I.E.:
let x = 5 ; (let y = 7 ; 9);;
Is an error, even though it consists only of sequences where lets are the first expression. Can someone explain how to get this to work?