Getting Started

Write and run OCaml code quickly

Overview

The "Getting Started" workflow is meant for somebody who just wants to try the OCaml language. The full extent to what they want to achieve is likely a few .ml files inside a directory using only tools from the standard library.

The barrier to entry should be low, it should be intuitive to setup and get started quickly. This is deal for OCaml workshops or education settings (in the first instance) before introducing more compilicated tooling to support larger more ambitious projects in the language.

For beginners how just want to try the language, the fastest and simplest solution is to use one of the tools that runs in the browser. Currently there are two options:

OCamlPro's Try OCaml

A simple web application that offers a text editor and console for running single file OCaml programs.

OCP Sandbox

OCaml-SF's Learn Ocaml

Very similar to Try OCaml with a toplevel and additionally, a series of OCaml exercises designed to help new programmers learn the OCaml language. It also includes a token system to save your code to a workspace online

ocaml-sf/learn-ocaml

Alternatives

Ocsigen, the creators and maintainers of js_of_ocaml, have an interactive toplevel with some nice examples. The related workflows link to more complex examples like interactiving with the DOM using OCaml.

OCaml toplevel