If, Else, and EndIf control execution flow based on a conditional test included with the If script statement. Adding an If command automatically inserts a matching EndIf command. Any number of commands can then be placed between the If and the EndIf.
Once an If command has been added to a script, an Else can optionally be added.
Syntax: | If | Expression | Comparison | Expression | Comment |
Syntax: | Else | Comment | |||
Syntax: | EndIf | Comment | |||
A set of comparison operators are supported | |||||
Comparison: | If | Expression | contains | Expression | test if first expression text contains 2nd expression text |
Comparison: | If | Expression | !contains | Expression | test if first expression text does not contain 2nd expression text |
Comparison: | If | Expression | == | Expression | test if comparison is equal |
Comparison: | If | Expression | != | Expression | test if comparison is not equal |
Comparison: | If | Expression | > | Expression | test if first expression is greater than 2nd expression |
Comparison: | If | Expression | < | Expression | test if first expression is less than 2nd expression |
Comparison: | If | Expression | >= | Expression | test if first expression is greater than or equal to 2nd expression |
Comparison: | If | Expression | <= | Expression | test if first expression is less than or equal to 2nd expression |
Example: | ![]() |
metric | == | 0 | test if metric = 0 |
instructions added between the If and EndIf are executed only if the If condition is true | |||||
![]() |
|||||
By right clicking on an If, an Else may be added between the If and the EndIf | |||||
Example: | ![]() |
metric | == | 0 | test if metric = 0 |
instructions added between the If and Else are executed only if the If condition is true | |||||
![]() |
|||||
instructions added between the Else and EndIf are executed only if the If condition is false | |||||
![]() |
Notes: