First of all, everyone should have access to the Ocaml distribution. If you do not, go to www.ocaml.org and download it for your respective platform. When it is installed, you should read the introduction and read the instructions for the main components. If you see a snippet you'd like to run, such as this one:
Printf.printf "Hello world!"There are two ways to do it: first, you can copy+paste the snippet into a top-level, and follow it with a double semicolon. Alternatively, you could copy it into a file, and precede it with "let somevar =
(* File snip.ml, which is compiled by "ocamlc -o snip snip.ml" *) let a = Printf.printf "Hello world!"
This assigns the return value of printf to the variable a, which ends up being the unit () (void, in essence). Many people prefer to use "let _ = Printf.printf "Hello world", which results in the return value being ignored.