Reading — step 1 of 5
Learn
~1 min readFirst Steps
OCaml was designed in 1996 at INRIA (France). It's the granddaddy of ML-family languages — F#, Reason, and ReScript all descend from it. Used heavily in finance (Jane Street, Bloomberg) and proof assistants (Coq, Lean).
let () = print_endline "Hello, OCaml!"
let () = ...is how you run a side-effect at top level. The()(unit) is OCaml'svoid.print_endlinewrites a string + newline.- No semicolons at end of statements (but
;;separates top-level definitions in REPL).
OCaml is strict (eagerly evaluated, unlike Haskell), statically typed (every value has a known type at compile time), and type-inferred (you almost never write the type — the compiler figures it out).
Comments use (* ... *) and can nest.
Discussion
Ask a question, share an insight, or help someone who’s stuck.
Sign in to post a comment or reply.
Loading…