The if
, then
and else
keywords add conditional constructs to an expression.
Note: see wikipedia for more explanation about if then else constructs.
Syntax
if boolean_condition
then value
else value
if boolean_condition then value
else if boolean_condition then value
else if boolean_condition then value
else if boolean_condition then value
else value
Returns
The value after the then
of the first condition that returns true.
If all conditions return false, then the value after else
is returned.
For combined if..then..else
statements, a choose..when
construction could be a more readable option.
All 3 segments (if, then, else) are required.