Everything is an expression
We have hinted at this concept in the previous chapter, but let's discuss it in more detail here.
In Elixir, there are no statements. Everything is an expression. Let's break this down. Statements typically refer to instructions where the programmer specifies to the computer or runtime to perform some action. This action could, for example, add two numbers together and assign the value to a variable. Or, it could instruct the machine to print data—strings, numbers, and bits—to the console. Or, it could instruct the machine to make a remote connection to another machine and request a web page. These actions may have ephemeral results—the value of the variable, output text on the screen, and page data from the request. But in all of these examples, the code, itself, which instructs the performance of such actions, does not necessarily, nor inherently return anything.
To contrast this to expressions, we note that we can still do all of these things, however, each instruction...