Logical relations (AND, OR, NOT)

The basic logical expressions described above can be combined with the logical relations AND, OR, and NOT to form more complex logical tests. Here is the list of supported logical relations with their precedence:

Precedence Relation Operation
1 NOT  Negation
2 AND  Logical AND
3 OR  Logical OR

The AND relation applies to two logical expressions, and will evaluate to TRUE if both logical expressions are themselves TRUE.

if ( file = "irvine.pix" AND channel = 1 ) print "success"

The OR relation applies to two logical expressions, and will evaluate to TRUE if one or both of the expressions is TRUE.

if ( file = "irvine.pix" OR file = "demo.pix" ) print "success"

The NOT relation applies to a single logical expression, and will evaluate to the opposite (or logical complement) of the expression. That is, the NOT relation applied to an expression will evaluate to TRUE of the expression is FALSE, and will evaluate to FALSE if the expression is TRUE.

if ( NOT file = "irvine.pix" ) print "success"

Since the use of a logical relation is itself a logical expression, logical relations can be combined to form more complex tests. When combining logical relations, it is often best to use brackets to ensure that the meaning of the test is clear.

if ( ((a = 1) AND (b=2)) OR ((a=2) AND (b=1)) ) print "success"

In this case, either a must equal 1 and b must equal 2, or alternatively a must equal 2 and b must equal 1 for the logical expression to evaluate to TRUE and success to be printed.

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.