Returns the result corresponding to the first matching value.
Switch(<value>, <case 1>, <result 1>, <case 2>, <result 2>, …, <else>)
value (required) The value to test.
case 1 (required): The case to test the value against. If the <value> matches <case>, the following <result> is returned.
result 1 (required): The result to be returned if its preceding case matches the input value.
case 2+, result 2+ (optional): Several <case> <result> pairs can be listed in a single function. Every supplied case must have a corresponding result.
else (optional): The result to be returned if no cases match the value. If no <else> condition is supplied, a Null result is returned when no cases are met.
Switch(1, 0, “None”, 1, “One”, “Many”)
- Returns “One”
Switch(2, 0, “None”, 1, “One”, “Many”)
- Returns “Many”
More About Logical Functions
Logical functions test for True/False values. They evaluate a condition, and return a value based on whether the condition is True or False.