IF <test> <statements1>
[ELSE <statements2>]
where <test> is one of the following:
<sortword> VALID
<sortword1>|(<expression1>) EQ|NE|GE|LE|GT|LT <sortword1>|<constant>|(<expression2>)
<sortword>|(<expression>) PASSES|FAILS <1D-gate>
<sortword>|(<expression>) MASKEDBY <16-bit mask>
<sortwordx>|(<expressionx>) [<sortwordy>|(<expressiony>)] GATEDBY <gate-expr>
and <gate-expr> is one of:
<gate-name>
<arraylist-of-gates>[<expression>]
where the gate dimension must match the number of arguments tested. The <expression> specified with the arraylist argument determines the offset into the arraylist, starting from zero, and hence the particular gate map referenced.
The IF command allows conditional execution of <statements1> or <statements2> depending on the result of a test. If the result is true, then <statements1> are executed, otherwise <statements2> are executed (if specified). The various forms of the IF command are described below in more detail.