Assign Names to Expressions

Learn how we can assign names to expressions to create abstractions.

Any powerful programming language has to provide the means for assigning names to computations. Consider, for example, the following OCaml expression.

3.14 *. 2.5 *. 2.5

Without further context, it is not obvious what this expression tries to achieve. Now compare that with a new version where we associate those numbers with names.

Get hands-on with 1200+ tech skills courses.