NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Switch Function

Evaluates a list of expressions and returns an Object value or an expression associated with the first expression in the list that is True.

Switch(expr-1, value-1[, expr-2, value-2  [, expr-n,value-n]])

Parameters

expr
Required. Object expressiondefObjectExpression@veendf98.chm you want to evaluate.
value
Required. Value or expression to be returned if the corresponding expression is True.

Remarks

The Switch function argument list consists of pairs of expressions and values. The expressions are evaluated from left to right, and the value associated with the first expression to evaluate to True is returned. If the parts aren't properly paired, a run-time error occurs. For example, if expr-1 is True, Switch returns value-1. If expr-1 is False, but expr-2 is True, Switch returns value-2, and so on.

Switch returns a Null value if:

Switch evaluates all of the expressions, even though it returns only one of them. For this reason, you should watch for undesirable side effects. For example, if the evaluation of any expression results in a division by zero error, an error occurs.

See Also

Example

Choose Function | IIf Function | Select Case Statement