Conditional statements allow us to execute or not certain instructions depending on the resulting assessment of a condition. The most frequent statements are the "if" statement and the "switch" statement.
The "if" statement executes a series of codes or another depending on the condition statement that is applied. It is probably the most important statement in any programming language.
In this example the condition is not true, so the part of the code corresponding to "else" is executed.
With the "switch" sentence we can execute one set of instructions or another depending on the value of a variable; in the aforementioned example depending on the value of the variable $position, block 1 is executed when the value is "up", block 2 is executed when the value is "down", and block 3 if it is neither of the previous values.