Skip to main content



IfCase Function

The IfCase function compares a test value against a list of values, returning the result from the first matching pair.

Syntax

IfCase(expression, testValue1, returnValue1, testValue2, returnValue2, ..., defaultReturn)

The IfCase function compares a test value against a list of values, returning the result from the first matching pair.

Arguments

expression Expression - The value to check equality against each test value.

testValue Any

returnValue Any

defaultReturn Any - The default return value, if none of the tests match.

Remarks

Example:

IfCase(expr, 1, "One", 2, "Two", 3, "Three", "1,2, or 3 only please"); // returns "Two"