SWITCH

Compares the input expression against a list of values and returns the corresponding result for the listed value upon first match. If no match is found, the default values is returned.

Syntax 

SWITCH(expression, value_to_compare, value_to_return, ..., default_value)

Usage examples 

Example 1

Formula

SWITCH(1+1, 2, 'true!', 1, 'false!', 'error!')

Output

"true!"

Example 2

Input

1
{
2
"day_of_week": [
3
"sunday"
4
]
5
}

Formula

SWITCH(day_of_week, 'monday', 'working', 'saturday', 'weekend', 'error')

Output

"error"
Was this helpful?