The if-expression selects from two expressions based on the value of a logical input value and evaluates only the selected expression.
The following are examples of if-expressions:
if 2 > 1 then 2 else 1 // 2 if 1 = 1 then "yes" else "no" // "yes"
The following holds when evaluating an if-expression:
If the value produced by evaluating the if-condition is not a logical value, then an error with reason code
The true-expression is only evaluated if the if-condition evaluates to the value
The false-expression is only evaluated if the if-condition evaluates to the value
The result of the if-expression is the value of the true-expression if the if-condition is
true, and the value of the false-expression if the if-condition is
Errors raised during the evaluation of the if-condition, true-expression, or falseexpression are propagated.