Node:if Statement, Next:, Previous:begin end Compound Statement, Up:Statements



if Statement

This statement has the following look:

if boolean_expression then
  statement
or with an alternative statement:
if boolean_expression then
  statement1
else
  statement2

The if ... then statement consists of a boolean expression and a statement, which is conditionally executed if the evaluation of boolean_expression yields true.

If if ... then ... else is concerned, statement1 is executed depending on boolean_expression being true, otherwise statement2 is executed alternatively. Note: the statement before else must not finish with a semicolon.