Script Command: IF


IF [options] {var1} {test} {var2} {ACTION} [else ACTION]

Conditional test. Used to support conditional branching within the script.

Options:

-b {base}        for use with numerical comparisons

Valid tests are:

gt        greater than
le        less than or equal to
ge        greater than or equal to
eq        equal to
ne        not equal to
or        var1 ORed with var2 is nonzero
and       var1 ANDed with var2 is nonzero
xor       var1 XORed with var2 is nonzero
sec       string equal (case insensitive)
seq       string equal
sne       string not equal

Valid actions are:

EXIT
RETURN
GOTO {tag}
GOSUB {tag}
RUN {scriptname}

Refer to EXAMPLE_2 on the main scripting page for a working example of the IF command.