ez.no / exponential / documentation / reference / template operators / logic / cond
cond( cond1, value1 [, cond2, value2 [, ... ] ] )
| Name | Type | Description | Required |
|---|---|---|---|
| cond1 | boolean | Match condition 1 | yes |
| value1 | mixed | Return value for condition 1 | yes |
| cond2 | boolean | Match condition 2 | no |
| value2 | mixed | Return value for condition 2 | no |
| ... |
Condition for first matching condotion
Returns the value for the first condition set to true. If the first condition is false, the second id checked, etc. until a condition is true.
If there are an odd number of parameters, the last parameter will be returned if all conditions fail.
{cond( true(), "Linux", "FreeBSD" )}
Returns "Linux".
{cond( false(), "Linux", true(), "FreeBSD" )}
Returns "FreeBSD".
{cond( false(), "Linux", "FreeBSD" )}
Returns "FreeBSD".
Comments