IFNUM        Conditional branch upon numeric variable comparison

Top  Previous  Next

Syntax:

IFNUMxx

[ num1 ] [ num2 ] GOTO  [ label ]

Forms:

IFNUM=

[ num1 ] [ num2 ] GOTO  [ label ]

 

IFNUM<

[ num1 ] [ num2 ] GOTO  [ label ]

 

IFNUM>

[ num1 ] [ num2 ] GOTO  [ label ]

 

IFNUM<=

[ num1 ] [ num2 ] GOTO  [ label ]

 

IFNUM>=

[ num1 ] [ num2 ] GOTO  [ label ]

 

IFNUM!=

[ num1 ] [ num2 ] GOTO  [ label ]

Arguments:

[ num1 ]

Variable, string, or numeric constant defining the first numeric value to compare against.

 

[ num2 ]

Variable, string, or numeric constant defining the second numeric value to compare against.

 

[ label ]

A valid label within the current script file which is branched to if the numeric condition is satisfied.

Options:

none

 

 

 

This command is used to compare two variables, strings that contain numeric values (e.g., contain only digits 0 - 9), or numeric constants. The command results in a syntax error if either value is non-numeric.

 

For example, the following conditional branch is taken if the numeric variable x is equal to 1000.

 

SETNUM x = 1000

IFNUM= x 1000 GOTO EqualValue

 

The following conditional branch is taken if the numeric variable x is larger than 1000. (Numeric strings are used instead of numeric constants simply as an example of allowed syntax.)

 

SETNUM x = "2300"

IFNUM> x "1000" GOTO LargerValue

 

Syntactically, no space is permitted to the left of the ‘!’, '=', '<' or '>' symbols, and a space is required to the right of these symbols.

 

 

Related command(s): DEC, INC, SETNUM

See also: Performing Variable Arithmetic and Numeric Comparisons