|
The American Programmer
|
|
REXX Comparison operators
How do you say equal, not equal, greater than, less than in REXX?
REXX IF
Comparison operators
= Equal. If numeric, when compared algebraically. (1.0 is equal to 001.000.) If not numeric, when padded with leading or trailing spaces. ("Sue" is equal to " Sue ".) Case is significant: "SUE" is not equal to "sue".
<> Not equal, the negation of "=". Algebraic comparison and padding are performed.
>< Not equal, the negation of "=". Algebraic comparison and padding are performed.
\= Not equal, the negation of "=". Algebraic comparison and padding are performed.
¬= Not equal, the negation of "=". (The symbol "¬" may not be found on all keyboards.) Algebraic comparison and padding are performed.
^= Not equal, the negation of "=". (The symbol "^" may not be found on all keyboards.) Algebraic comparison and padding are performed.
> Greater than. Algebraic comparison and padding are performed.
< Less than. Algebraic comparison and padding are performed.
>= Greater than or equal to. Algebraic comparison and padding are performed.
¬< Not less than. (The symbol "¬" may not be found on all keyboards.) Algebraic comparison and padding are performed.
\< Not less than. Algebraic comparison and padding are performed.
<= Less than or equal to. Algebraic comparison and padding are performed.
¬> Not greater than. (The symbol "¬" may not be found on all keyboards.) Algebraic comparison and padding are performed.
\> Not greater than. Algebraic comparison and padding are performed.
== Strictly equal on a character-by-character basis. No algebraic comparison or padding is done.
¬== Strictly not equal, the negation of "==". (The symbol "¬" may not be found on all keyboards.) No algebraic comparison or padding is done.
\== Strictly not equal, the negation of "==". No algebraic comparison or padding is done.
>> Strictly greater than. No algebraic comparison or padding is done.
>>= Strictly greater than or equal to. No algebraic comparison or padding is done.
<< Strictly less than. No algebraic comparison or padding is done.
<<= Strictly less than or equal to. No algebraic comparison or padding is done.
¬>> Strictly not greater than. (The symbol "¬" may not be found on all keyboards.) No algebraic comparison or padding is done.
¬<< Strictly not less than. (The symbol "¬" may not be found on all keyboards.) No algebraic comparison or padding is done.
& And. The conditions on both sides of this operator must be true.
| Or. One or both of the conditions on either side of this operator must be true.
&& Exclusive Or. Only one, but not both, of the conditions on either side of this operator must be true.
The difference between = and ==
= Equal
= asks if two things are equal, accounting for leading/trailing spaces and numeric equivalency.
IF "JOE" = "JOE " THEN SAY "YES" /* they are equal */
IF 100 = 0100.00 THEN SAY "YES" /* they are equal */
== Strictly Equal
== asks if two things are exactly equal, on a character by character basis
IF "JOE" == "JOE " THEN SAY "YES" /* they are not equal */
IF 100 == 0100.00 THEN SAY "YES" /* they are not equal */
IF "JOE" == "JOE" THEN SAY "YES" /* they are equal */
IF 100 == 100 THEN SAY "YES" /* they are equal */
The same principle applies to ¬==, \==, >>, >>=, <<, <<=.
|
Home
|
Programming
|
Books for Computer Professionals
|
Privacy
|
Terms
|
Contact
|
|
Site Map and Site Search
|
Programming Manuals and Tutorials
|
The REXX Files
| Top of Page
|