It's an expression and ;; says to ocaml treats this line as expression
3 + 4 ;;
And heres variable declaration or let binding
let x = 3 + 4 ;;
(** val x : int = 7 *)
After a new variable is created, the toplevel tells us the name of the variable (x), in addition to its type (int) and value (7).
Also with let you can define a function
let square x = x * x ;;
(** val square : int -> int = <fun> *)
square (square 2) ;;
(** - : int = 16 *)
Function in ocaml is a first class citizen.
Note:
;;
is required only in repl, not in your source code.
Top comments (2)
Note that
;;
is only needed in the REPL to tell it that the line is finished, not in source code.Yeah, my bad. I'll fix it now. Thanks for your feedback