If-statement
If-statements or also if-else-statements make up an essential part of every program. These
statements check if a specified condition is met and react accordingly. If the specified condition
isn’t met, the program will execute a different code, which may be specified inside an
else
code block.
It is also possible to check multiple different conditions by using else if
blocks.
Syntax
They must have a single starting if
, may have multiple extending
else if
branches and can have a single ending else
branch, which is
evaluated if the previous condition were all false
.