Switch
Function | Parameters | Return value |
---|---|---|
Switch |
params object[] expressions |
object |
The argument supplied to expressions consists of paired expressions and values. The Switch function evaluates the odd-numbered expressions from lowest to highest index, and returns the even-numbered value associated with the first expression that evaluates to True.
Example:
// returns one of the following values - "а greater than 0",
// "а less than 0", "а equals to 0", depending on "a" value
Switch(
a > 0, "а greater than 0",
a < 0, "а less than 0",
a == 0, "а equals to 0")