About this task
You often use a comparison expression in an IF…THEN…ELSE
instruction. The following example uses an IF…THEN…ELSE
instruction to compare two values. For more information about this
instruction, see section
IF…THEN…ELSE Instructions.
Figure 1. Example
Using a Comparison Expression/****************************** REXX *********************************/
/* This program compares what you paid for lunch for two */
/* days in a row and then comments on the comparison. */
/*********************************************************************/
PARSE PULL yesterday /* Gets yesterday's price from input stream */
PARSE PULL today /* Gets today's price */
IF today > yesterday THEN /* lunch cost increased */
SAY "Today's lunch cost more than yesterday's."
ELSE /* lunch cost remained the same or decreased */
SAY "Today's lunch cost the same or less than yesterday's."