Syntax error OCaml

Indeed, there is nothing wrong apart from the semicolon. Think about why did you wrote it. Your intent was likely to state that your statement was finished (it has this meaning in a lot of languages). BUT in ocaml, single semicolon does not have this meaning at all. I do not know how to explain it clearly, so I provide you example to express this:

let x = () ; (* alone: invalid code*)

let x = () ; 7 (* valid code; literally the same that let x = 7 *)

let x = 4 ; 7 (* invalid code, because expression ending with ";"
                 must be of unit type *)

let x = () ; let y = 7 in y + 3 (* valid code, equivalent to let x = 10 *)

let x = 2 ;
let y = 7  (* invalid code because 2 is not of unit type AND
              let y = 7 should be followed by in <expression>.
              Without the ";", it would have been valid code *)

Be careful because improper use of single semicolon in ocaml leads to error messages very unlikely to help you. (syntax error at a place you would not expect as a beginner).

Welcome and have a good day :slight_smile: