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.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Refresh Type the characters you see in this picture. Type the characters you see in the picture; if you can't read them, submit the form and a new image will be generated. Not case sensitive.  Switch to audio verification.