OS/2 Procedures Language 2/REXX


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


DO UNTIL Example


A procedure using a DO UNTIL loop is DOUNTIL.CMD.  It tests for a true or 
false condition at the bottom of the loop: 

/* Using a DO UNTIL loop */
SAY 'Enter the amount of money available'
PULL salary
spent = 0          /* Sets spent to a value of 0 */
DO UNTIL spent > salary
   SAY 'Type the cost of item'
   PULL cost
   spent = spent + cost
END
SAY 'Empty pockets.'
EXIT

When run, DOUNTIL.CMD displays on your screen as: 

[C:\] DOUNTIL
Enter the amount of money available
50
Type the cost of item
37
Type the cost of item
14
Empty pockets.
[C:\]
  

Inf-HTML End Run - Successful