The if statement
The if statement is used to conditionally execute a block of code. It checks whether a condition is true or false, that is, the result type must be boolean. The conditional statement may optionally be followed by the keyword then followed by a block of code.
If the condition result is true, the block is executed. After the body of the if has been executed, control is transferred to the next statement following the if statement.
If the condition result is false and an else clause is present, the statement or block following the else is executed. After the body of the else clause has been executed, control is transferred to the next statement following the if statement.
If the condition result is false and the else clause is not present, control is transferred to the next statement following the if statement.