Send Close Add comments: (status displays here)
Got it!  This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
OCaml


1. OCaml
OCamlOCaml is an industrial strength programming language supporting functional, imperative and object-oriented styles. From the OCaml web site at https://ocaml.org/ .

2. CentOS 7 installation
The following Linux command(s) install ocaml.
sudo yum -y install ocaml


3. Installed version
The following Linux command(s) display installed version of ocaml.
ocaml --version

On 2019-08-16 the output was as follows.
The OCaml toplevel, version 4.05.0


4. Hello world in OCaml
The file type of a OCaml program file is ml.

The following Linux command(s) create/edit a hello program in the your home directory using the nano text editor.
nano ~/hello.ml

Create the following program text in the editor that will output the text "Hello world"
print_string "Hello world\n";;

To exit with save, remember to press Ctrl-X, then "y" (for yes) and Enter to exit.

The following Linux command(s) run the program.
ocaml hello.ml

The output should be as follows.
Hello world


5. End of page