Conditional expressions

The result of a conditional expression can be one value or another, depending on a condition.

gross revenue = $10k
tax = if gross revenue > $5k then 10% else 5%
net income = gross revenue - tax

A conditional expression can also appear as an operand; in this case, it should be placed in parentheses.

gross revenue = $10k
net income = gross revenue - (if gross revenue > $5k then 10% else 5%)