I have this code in Ocaml
let double x = 2 * x
let triple x = 3 * x
let s = "Hello" in print_endline s
let () = triple 10 |> string_of_int |> print_endline
and when compiling with ocamlc file.ml this gives the error:
File "file.ml", line 5, characters 16-18:
Error: Syntax error
If I put ;; at the end of line 3 like this
let triple x = 3 * x;;
of if I comment characters 16-18 in line 5 like this
let s = "Hello" (* in print_endline s *)
the syntax error goes away.
Can someone explain the reason of the syntax error, and what each of these two corrections do to resolve it?