|
The American Programmer
|
|
REXX Boolean operators
How do you say AND, OR, and EXCLUSIVE OR in REXX?
REXX Boolean operators
& AND
| OR: either one, or both
&& Exclusive OR:
one is true, not both.
& (AND)
IF PAY_GRADE = 11 & NAME = "ELLEN"
THEN SALARY = SALARY * 2
| (OR)
IF PAY_GRADE = 11 | PAY_GRADE = 12
THEN SALARY = SALARY * 1.5
&& (Exclusive OR)
IF PAY_GRADE = 11 && EMPLOY_STATUS = "RETIRED"
THEN NOP
ELSE SAY "INPUT DATA ERROR"
The English words AND/OR don’t work. They may not produce a syntax error but will produce the wrong results.
IF PAY_GRADE = 11 AND NAME = "ELLEN"
THEN SALARY = SALARY * 2
Will compare PAY_GRADE to the character string 11 AND NAME = "ELLEN" and the results will be wrong.
|
Home
|
Programming
|
Books for Computer Professionals
|
Privacy
|
Terms
|
Contact
|
|
Site Map and Site Search
|
Programming Manuals and Tutorials
|
The REXX Files
| Top of Page
|