IF
The IF statement takes two or more arguments.
Every pair of arguments is evaluated as a condition; the final argument is the default: IF( condition, then-val [, condition2, then-val2]... [, else-val]).
- If
conditionevaluates to true, evaluates tothen-val. - If
condition2is specified, then if it is true, evaluates tothen-val2. - If
else-valis not specified, evaluates to null. - Otherwise evaluates to
else-val.
true, evaluate to true.
IF is equivalent to nested IF statements:
SWITCH
The SWITCH statement takes three or more arguments.
The first argument is the value to test the cases against.
Every pair of arguments is evaluated as a case and the value to return.
If there is an unpaired final argument, it will be returned as the default if none of the cases match.
If no default value exists, then null will be returned.
SWITCH( expression, case1, val1[, case2, val2]... [, default-val]).
- If
expressionequalscase1, evaluates toval1. - If
case2is specified and equalsexpression, evaluates toval2. - If
default-valis not specified, evaluates to null. - Otherwise evaluates to
default-val.
EQUALS apply for testing cases.