5.1 Variables are names for values

let [var] : [type] = [expre. def] in [expre. body]
let pi: float = 3.1416 in 
pi *. 2. *. 2.;;
-: float = 12.5664

5.2 The type of a let- bound variable can be inferred

<aside> 💡 the type information in the let construct is optional because OCaml is implicitly typed

</aside>

let pi = 3.1416 in
pi *. 2. *. 2. ;;

5.3 let expressions are expressions

# 3.1416 *. (let radius = 2.
# in radius *. radius) ;;
- : float = 12.5664
# let pi = 3.1416 in
# let radius = 4. in
# pi *. radius ** 2. ;;
- : float = 50.2656

5.4 Scope

# (let s = "hi ho " in
# s ^ s) ^ s ;;
Line 2, characters 9-10:
2 | s ^ s) ^ s ;;
^
Error: Unbound value s
# let x = x + 1 in
# x * 2 ;;
Line 1, characters 8-9:
1 | let x = x + 1 in
						^
Error: Unbound value x