OS/2 Procedures Language 2/REXX


Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs


True and False Operators


Determining if an expression is true or false is useful in your 
procedures.  If an expression is true, the computed result is 1.  If an 
expression is false, the computed result is 0.  The following shows some 
ways to check for true or false operators. 
Comparisons - Some operators you can use for comparisons are: 
 >             Greater than 
 <             Less than 
 =             Equal to 
 
 Comparisons can be made with numbers or can be character-to-character. 
  Some numeric comparisons are: 
 The value of 5 > 3 is 1       This result is true. 
 The value of 2.0 = 002 is 1   This result is true. 
 The value of 332 < 299 is 0   This result is false. 
 
 If the terms being compared are not numbers, the interpreter compares 
 characters.  For example, the two words (strings) airmail and airplane 
 when compared character for character have the first three letters the 
 same.  Since m < p, airmail < airplane. 
 Equal - An equal sign (=) can have two meanings in REXX, depending on its 
 position.  For example, 

 amount = 5              /* This is an assignment */
 
 
 gives the variable amount, the value of 5. If an equal sign is in a 
 statement other than as an assignment, it means the statement is a 
 comparison.  For example, 

 SAY amount = 5           /* This is a comparison  */
 
 
 compares the value of amount with 5.  If they are the same, a 1 is 
 displayed, otherwise, a 0 is displayed. 
 For more examples of using comparisons, select the Examples pushbutton. Using Comparisons
   

Inf-HTML End Run - Successful