Exercises - Using Comparison Expressions

About this task

Procedure

  1. Based on the preceding example of using a comparison expression, what result does the language processor produce from the following lunch costs?
    Yesterday's Lunch
    Today's Lunch
     
     
    4.42
    3.75
    3.50
    3.50
    3.75
    4.42
  2. What is the result (0 or 1) of the following expressions?
    1. "Apples" = "Oranges"
    2. " Apples" = "Apples"
    3. " Apples" == "Apples"
    4. 100 = 1E2
    5. 100 \= 1E2
    6. 100 \== 1E2

Results

ANSWERS
  1. The language processor produces the following sentences:
    1. Today's lunch cost the same or less than yesterday's.
    2. Today's lunch cost the same or less than yesterday's.
    3. Today's lunch cost more than yesterday's.
  2. The expressions result in the following. Remember 0 is false and 1 is true.
    1. 0
    2. 1
    3. 0 (The first " Apples" has a space.)
    4. 1
    5. 0
    6. 1

Task Task

Feedback


Timestamp icon Last updated: Tuesday, 7 January 2014


http://pic.dhe.ibm.com/infocenter/cicsts/v5r1/topic/com.ibm.cics.rexx.doc//dfhrx/dfhrx00034.html