---
title: "Flow Control with If-Then-Else"
canonical: "https://docs.infoblox.com/space/netmri760/357206312/Flow%20Control%20with%20If-Then-Else"
format: markdown
---
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.