Logic Commands

If, End, and EndExit Commands

The If command tests a condition. If the condition is true, one or more lines of logic is executed. A condition tests the relationship between two values. The operators you can use to test a condition are listed in the following table:

Operator

Meaning

Example

<

Less than

If Sale.Price < 10000

NOT <

Not less than

If Sale.Price NOT < 10000

>

Greater than

If Sale.Price > 30

NOT >

Not greater than

If Sale.Price NOT > 30

=

Equal to

If Sale.CustType = “A”

NOT =

Not equal to

If Sale.CustType NOT = “A”

NUMERIC

Is numeric

If myNum NUMERIC

<=

Less than or equal to (not greater than)

If Sale.Price <= 10000

>=

Greater than or equal to (not less than)

If Sale.Price >= 10000

You can also test for more than one condition in a statement by combining conditions. The logical operators you can use to test compound conditions are listed in the following table:

Operator

Meaning

Example

NOT (~)

Logical NOT

If ~ Sale.CustType = “A”

AND (&&)

Logical AND

If numC = 3 && numB = 25

OR (||)

Logical OR

If Sale.CustType = “A” || Sale.Price < 10000