A relational operator compares two arithmetic expressions, or two character expressions, and evaluates to a single logical value. The operators can be any of the following:
Table 3-8 Relational Operators
Operator |
Meaning |
---|---|
.LT. .LE. .EQ. .NE. .GT. .GE. |
Less than Less than or equal Equal Not equal Greater than Greater than or equal |
The period delimiters are necessary.
All relational operators have equal precedence. Character and arithmetic operators have higher precedence than relational operators.
For a relational expression, first each of the two operands is evaluated, and then the two values are compared. If the specified relationship holds, then the value is true; otherwise, it is false.
Example: Relational operators:
NODE .GE. 0 X .LT. Y U*V .GT. U-V M+N .GT. U-V Mixed mode: integer M+N is promoted to real STR1 .LT. STR2 STR1 and STR2 are character type S .EQ. 'a' S is character type
For character relational expressions:
"Less than" means "precedes in the ASCII collating sequence."
If one operand is shorter than the other, the shorter one is padded on the right with blanks to the length of the longer.