Syntax

SWITCH( some-value , expected-value1 , expected-result1[, expected-value2 , expected-result2]... , default-result )

Description

SWITCH() attempts to match some-value (of any type) to one of a set of expected-values (of any comparable type). If a match is found, the corresponding expected-result (an expression) is evaluated and its result returned. If no match is found, default-result (an expression) is evaluated and its result returned. Every result expression should produce a value of the same type.

Return Value

The result of evaluating the expected-result that corresponds to the expected-value that matches some-value, or the result of evaluating default-result if no match is found.

Did this answer your question?