FORTRAN 77 Language Reference

Relational Operator

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









Less than 

Less than or 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: