The if statement
The if statement is used to conditionally execute a statement or block.
The condition, 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 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.
For more information, see
Defining conditional logic.