 # Relational Operators

Relational operators provide a way to test two values to determine if they are equal or not, or if one is less than or greater than the other. All of the relational operators require two operands. A relational expression takes the following form:

operand1 relational_operator operand2

With one exception, only operands of the same data type can be compared with one another. If one operand is an integer and the other operand is a real number, the integer value is converted to a real number before the comparison is made.

Wildcards can be used in string comparisons of equality or inequality. For example, the string "ELEC*" matches any string that begins with the characters ELEC. Similarly, "*PLUMB*" matches any string that contains the substring PLUMB. The following characters have a special meaning in comparisons with string keywords:

Character Function
* matches zero or more occurrences of any character
? matches exactly one occurrence of any character
\ indicates that the next character is to be treated as an actual character and not as a special character. In other words, it disables the special meaning of the asterisk (*) and question mark (?) characters.

The result of a relational expression is a value of true if the condition is satisfied and false if the condition is not satisfied. The following list describes the relational operators, as well as some example relational expressions:

Operator Result
.EQ. , EQ , or == true if operand1 and operand2 are equal
.NE. , NE , or <> true if operand1 and operand2 are not equal
.GE. , GE , or >= true if operand1 is greater than or equal to operand2
.LE. , LE , or <= true if operand1 is less than or equal to operand2
.GT. , GT , or > true only if operand1 is greater than operand2
.LT. , LT , or < true only if operand1 is less than operand2

Examples:

 (color == 5) (level .NE. 7) (cellname == "PLAN*") (thickness > 0.5)