conditional expression (same as if/elsif). |
|
| see if, when, zena 1.0 | |
Example
<r:case> <r:when test='cardboard'>...the node has a 'cardboard' attribute...</r:when> <r:when test='paper'>...the node has a 'paper' attribute...</r:when> <r:else>...</r:else> </r:case>
See if on how to create test clauses.
ClassCondition
You can replace <r:when> clauses with class conditions:
<r:case> <r:Project?>...</r:Project?> <r:Page?>...</r:Page?> <r:else>...</r:else> </r:case>
Note that this is a special case of the ClassCondition because we are in a “case” scope (parent method is ‘case’). The difference is that here, only one scope will be executed (Project for example). But with normal class scopes, all matching scopes would run (Project & Page for example).