Please enable JavaScript to view this site.

 

Navigation: Macros > Macro Language > Operators

Comparison Operator

Scroll Prev Up Next More

Comparison operators compare either integer or string expressions, and return true or false depending if the comparison is true or false. The comparison operators are:

 

 

integers

strings (case-sensitive)

>

greater than

strict contains

(equal strings return false)

>=

greater or equal

contains or is equal

(equal strings return true)

<

less than

strict is contained

(equal strings return false)

<=

less than or equal

is contained or is equal

(equal strings return true)

<>

not equal (ie. different)


 

These operate slightly differently depending on the type of arguments used.

 

integers

 

The meaning of the above operators for integers is obvious:

4 > 3    // true
4 <> 3   // true
4 >= 3   // true

strings

 

For strings, these operators compare containment, not alphabetical order.

 

The operators < and > require strict containment: identical strings return false. <= and >= also return true when the strings are identical.

 

Operator

Meaning for strings

sLeft < sRight

sLeft is contained in sRight, and they differ

sLeft <= sRight

sLeft is contained in or equal to sRight

sLeft > sRight

sLeft contains sRight, and they differ

sLeft >= sRight

sLeft contains or equals sRight

 

When operating on strings, the comparison is case-sensitive.

'Nov' <> 'nov' // these are different strings

Mixed types

 

Note that, although the above can operate on either integers or strings, in a given expression, all arguments must be of the same type. The following expression is invalid :

'8' < 9 // mismatched data types !!!

Finally, to improve legibility it is customary, but not necessary, to enclose the comparison expression in parentheses.

 


Topic 122400, last updated on 08-Oct-2026