February 2018
Beginner
200 pages
4h 37m
English
Elixir can generate a result for any expression. The process is similar to when you were in high school solving mathematical equations: to generate a result, you must add or multiply some numbers or change some Xs to Ys. We’ll create expressions for the computer, and the computer will show us the result. The simplest expression is a value, like this:
| | iex> 42 |
| | 42 |
The number 42 is an expression that evaluates to the value we typed. Let’s try a different expression:
| | iex> 1 + 1 |
| | 2 |
The number 1 is a value, and + is an operator. Operators compute values and generate a result. We can also combine multiple operators and values:
| | iex> (2 + 2) * 3 |
| | 12 |
| | iex> 2 + 2 * 3 |
| | 8 |
Each operator is executed in a ...
Read now
Unlock full access