Relational operators

A relation is a logical expression that compares two values using a relational operator. In the command

IF (X EQ 0) Y=1 

the variable X and 0 are expressions that yield the values to be compared by the EQ relational operator. The following are the relational operators:

EQ or =. Equal to

NE or ~= or ¬ = or <>. Not equal to

LT or <. Less than

LE or <=. Less than or equal to

GT or >. Greater than

GE or >=. Greater than or equal to

  • The expressions in a relation can be variables, constants, or more complicated arithmetic expressions.
  • Blanks (not commas) must be used to separate the relational operator from the expressions. To make the command more readable, use extra blanks or parentheses.
  • For string values, “less than” and “greater than” results can vary by locale even for the same set of characters, since the national collating sequence is used. Language order, not ASCII order, determines where certain characters fall in the sequence.