Comparison operators

Navigation:  Appendices > Macro Language > Operators >

Comparison operators

Previous pageReturn to chapter overviewNext page

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 :

 

 >        greater than

 >=        greater or equal

 <        less than

 <=        less than or equal

 <>        not equal (ie. different)

 

These operate slightly differently depending on the type of arguments used. The meaning of the above operators for integers is obvious :

 

4 > 3

4 <> 3

4 >= 3

 

When used on string arguments, a > b is taken to mean that a contains b, and a < b means that a is contained in b.

 

'Nov' < 'November'

'Nov' <= 'November'

'Nov' <> 'November'

'November' > 'Nov'

 

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

 

'Nov' <> 'nov' // neither of the 2 contains the other

 

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 updated on 18-Jan-2001.
Topic URL: http://www.qppstudio.net/webhelp/index.html?comparison().htm