OCaml create module for Map then a class doesn't work

Hello,
I have to learn the awfull language OCaml
on a problem I did just that :

module Childs = Map.Make(Int)

class node =
object (self)
    val mutable childs : node Childs.t = Childs.empty
end

let prerr_int_space nb =
    prerr_int nb;
    prerr_char ' ';
in

prerr_int_space 42;

The console returns :
“File “/tmp/Answer.ml”, line 14, characters 0-2:
14 | in
^^
Error: Syntax error”

I read a lot of ressource of the net, it seems i did nothing wrong, that should works.

Have a good day :slight_smile:

I think you need to add ;; after end.

1 Like

It works, thanks :+1:
I thought ;; syntax was only for utop.

I found another syntax which is writing "let () = " just after my class declaration.

Anyway I prefer the ;; syntax you gave me :slight_smile: