Execute statements if condition is true
ifexpression
statements
elseifexpression
statements
elsestatements
end
if
evaluates an expression,and executes a group of statements when the expression is true. Anexpression is true when its result is nonempty and contains only nonzeroelements (logical or real numeric). Otherwise, the expression is false.expression
, statements
,end
The elseif
and else
blocksare optional. The statements execute only if previous expressionsin the if...end
block are false. An if
blockcan include multiple elseif
blocks.
You can nest any number of if
statements.Each if
statement requires an end
keyword.
Avoid adding a space after else
withinthe elseif
keyword (else if
).The space creates a nested if
statement that requiresits own end
keyword.