OS/2 Procedures Language 2/REXX


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


DO WHILE Example


A procedure using a DO WHILE loop is DOWHILE.CMD.  It tests for a true or 
false condition at the top of the loop. 

/* Using a DO WHILE loop */
SAY 'Enter the amount of money available'
PULL salary
spent = 0
DO WHILE spent < salary
   SAY 'Type in cost of item'
   PULL cost
   spent = spent + cost
END
SAY 'Empty pockets.'
EXIT

After running the DOWHILE procedure, you see this on your screen: 

[C:\]dowhile
Enter the amount of money available
100
Type in cost of item
57
Type in cost of item
24
Type in cost of item
33
Empty pockets.
[C:\]
  

Inf-HTML End Run - Successful