The if statement
The if statement is used to conditionally execute a statement or block.
IfStatement
Rule components
The expression, whose result type must be boolean, is evaluated and if its result is true the block following the then keyword is executed. After the body of the then clause has been executed, control is transferred to the next statement following the if statement.
If the expression 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 expression result is false, and the else clause is not present, control is transferred to the next statement following the if statement.