if
Returns valueTrue if the Boolean condition is true, and valueFalse if false. Only the selected subexpression is evaluated. Both subexpressions must be of the same type, which is also the return type.
Signature
if(condition:Boolean, valueTrue:any type, valueFalse:any type) -> any type |
Parameters
Name | Type | Description |
---|---|---|
condition | Boolean | Specifies the condition to evaluate. |
valueTrue | any type | Specifies a subexpression to return when condition evaluates to true. |
valueFalse | any type | Specifies a subexpression to return when condition evaluates to false. |
Examples
The following expression passes a Boolean as XML Schema conformant value:
if(b, "true", "false") |
An alternative way to do this:
if(b, "1", "0") |