/
Flow Control with If-Then-Else
Flow Control with If-Then-Else
You use <If>
elements to make logical branching decisions. It must have an <Expr>
element for the conditional, followed by a <Then>
element (which is statement block), and optionally by an arbitrary number of <ElseIf>
statements and an <Else>
statement.
<If>
<Expr op='=='>
<Expr field='parent_device.DeviceModel'/>
<Expr value='N7Kc7010'/>
</Expr>
<Then><PolicyRulePass/></Then>
<Else><PolicyRuleFail/></Else>
</If>
In this example, the <Then>
and <Else>
elements are simple statement blocks, with no supported attributes. ElseIf
elements should have an <Expr>
for the conditional, followed by a <Then>
statement block.