|
|
There's no main function in OCaml, rather statements that can have side effects (here printing to stdout). |
|
A more idiomatic way to write this is to enforce that the code returns nothing, or in OCaml term that it returns the "unit" symbol `()`. |
|
|
|
You can compile your code with the OCaml compiler `ocamlc`, similar to C programs. |
|
|
|
We can use the `core` library we installed in the previous example by "opening" it. We can then use Core's [printf](https://ocaml.janestreet.com/ocaml-core/odoc/stdlib/Stdlib/Printf/index.html) function directly. Notice that arguments of a function are not surrounded by parenthesis or commas. |
|
|
|
To compile code using external libraries, you can use `ocamlfind` which will do the work of finding and linking these libraries at compilation time. |
|