OCaml - Variable - Creating variables

For creating variables in OCaml we need to use the let keyword.

The syntax to create a variable is the following:


# let myVar = 90;;

When you type enter, it will be displayed the type of your variable:


val myVar : int = 90

The OCaml interpreter will find the type by itself.
This mechanism is called the inference. smiley

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.