Definition of True and False

A predicate expression is an expression that is evaluated as being "true" or "false" as part of a statement that controls program execution. IDL evaluates predicate expressions in the following contexts:

The definition of true and false for the different data types is as follows:

Table 7-3: Default Definitions of True and False

Data Type
True
False

Byte, integer, and long

Odd integers

Zero or even integers

Floating point and complex

Non-zero values

Zero

String

Any string with non-zero length

Null string (" ")

Heap variables (pointers and object references)

Non-null values

Null values

If the LOGICAL_PREDICATE compile option is set:

Table 7-4: True and False Definitions with LOGICAL_PREDICATE 

Data Type
True
False

Numerical values

Non-zero values

Zero

String or heap variables

Non-null values

Null values

See "COMPILE_OPT" (IDL Reference Guide) for additional details on the LOGICAL_PREDICATE compilation option.

In the following example, the logical statement for the condition is a conjunction of two conditions:

IF (LON GT -40) AND (LON LE -20) THEN ... 

If both conditions (LON being larger than –40 and less than or equal to –20) are true, the statement following the THEN is executed.