if
Returns valueTrue if the Boolean condition evaluates to true, and valueFalse if it evaluates to false. Only the selected sub-expression is evaluated. Both sub-expressions must be of the same type, which is also the return type of the expression.
Signature
if(condition as Boolean, valueTrue as any type, valueFalse as any type) -> any type |
Parameters
Name | Type | Description |
|---|---|---|
condition | Boolean | Specifies the condition to evaluate. |
valueTrue | any type | Specifies a sub-expression to return if condition evaluates to true. |
valueFalse | any type | Specifies a sub-expression to return if condition evaluates to false. |
Examples
The expression below passes a Boolean as an XML Schema-conformant value. The expression returns true if b is true, otherwise false.
if(b, "true", "false") |
Below is an alternative representation of a Boolean value as a numeric string.
if(b, "1", "0") |