If you put the ;;
in the file it will work. Without that, it doesn't make sense syntactically. An expression 1
followed by the keyword assert
doesn't make sense.
I don't particularly like using ;;
in actual code (not at top-level, i.e., the interpreter). If you wanted to avoid it too, you could write
let x = 1
let () = assert (x > 2)