The IF ELSE statement can be used as a main statement, or within a parent statement, to return a value depending on whether a condition, or a series of conditions match. The statement allows for multiple ELSE IF expressions, and a final ELSE expression, with no limit to the number of ELSE IF conditional expressions.
Note
As THROW, CONTINUE, and BREAK do not return an expression, they must be inside a separate code block inside an IF ELSE statement.
An IF ELSE syntax uses {} to open up a code block on each condition check which will be run when it evaluates as truthy.
The following queries show example usage of this statement.
The smallest possible IF THEN statement simply does something when a condition is true, and nothing otherwise.
IF9=9{'Nine is indeed nine'};
As the last line of a scope is its return value, the RETURN keyword can also be placed before the entire IF THEN statement. This is particularly convenient in long IF ELSE chains to avoid using the RETURN keyword at the end of every check for a condition.