Hello, OCaml

This blog can run OCaml in your browser. The block below evaluates as soon as the page loads, and prints its output underneath:

let () = Printf.printf "2 + 2 = %d
" (2 + 2)
 

Everything runs client-side via a WebAssembly build of OCaml (wasm_of_ocaml) — there is no server executing your code. Edit the source above and press Run to re-evaluate.

You can also call into the bundled library:

let () = print_endline (Mylib.greeting "world")