You can perform basic conditional expressions using if-else and switch alternatives.
String | Description |
---|---|
Any ifelse(Boolean <condition>, Any
<value>, Boolean
<elseifCondition<1...10>>,
Any <elseifValue<1...10>>, Any
<elseValue>) where:
|
Library function for an If-Else statement. Expressions provided for If and elseIf conditions should evaluate to a boolean value and if not, every attempt will be made to convert the evaluated value to boolean. If the condition evaluates to a Number, any value greater than 0
will be treated as True, or else false. If the condition
evaluates to a String, the values The If statement and elseIf statement is a pair: a condition and a value to be used if condition evaluates to true. The elseIf statements are optional, and can enter 0 to 10 elseIf statements as needed. The elseValue to be used if no condition evaluates to true is also optional and is always the last parameter in the method. |
Any switchExpr(Any
<valueToFind>, Any
<choiceToMatch1>, Any
<valueToReturn1>, Any
<choiceToMatch<2...10>>, Any
<valueToReturn<2...10>>, Any
<defaultValue>) where:
|
Library function for a switch statement. A <valueToFind> is compared against 1 or more choices to match (<choiceToMatch<1...10>>). If a match is found, the value corresponding to the matched choice (<valueToReturn<1...10>>) is returned. If no match is found, <defaultValue> is returned if provided, or else null. <choiceToMatch<n>> and <valueToReturn<n>> are a pair and there should be a minimum of 1 pair and not exceed 10 pairs. A default value can be provided as the last parameter to the method. |
Examples
String | Input |
---|---|
Any ifelse(Boolean <condition>, Any
<value>, Boolean
<elseifCondition<1...10>>,
Any <elseifValue<1...10>>, Any
<elseValue>) |
|
Any switchExpr(Any
<valueToFind>, Any
<choiceToMatch1>, Any
<valueToReturn1>, Any
<choiceToMatch<2...10>>, Any
<valueToReturn<2...10>>, Any
<defaultValue>) |
|