PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
[Bottom][Contents][Search][Prev]: Rexx Conditional Logic[Next]: Rexx Parsing
\ -> Rexx -> Rexx Looping

Rexx Looping

You can get a rexx manuals (for regina) from http://www.lightlink.com/hessling/, there are HTML and PDF versions available.

Loops are one of the complex areas of rexx and most things you will wish to do with PPWIZARD will either not require them or the simpler PPWIZARD loops will be enough.

The syntax of rexx loops is as follows:

DO [ symbol=start   [TO  finish]  ]     [WHILE expression_w]
   [                [BY  step  ]  ]
   [                [FOR count ]  ]     [UNTIL expression_u]

   [ expression_c                 ]     [FOREVER           ]

Examples follow (these would need to be integrated with PPWIZARD using the #evaluate command :

do 10
   /* Do something 10 times */
end

do _Count = 1 to 100
   /* Do something 100 times (Count given values 1,2,3 to 100) */
end

do _Multiple = 0 to 20 by 2.3
   /* Loop with _Multiple = all multiples of 2.3 not more than 20 */
end

do _Multiple = 0 for 6 by 5.7
   /* Loop with _Multiple = the first six multiples of 5.7 */
end

_Finished = 'N'
do while _Finished = 'N'
   /* Set _Finished variable to 'Y' to exit loop */
end;

do until _Finished = 'Y' & _Fred <> 0
   /* Set _Finished variable to 'Y' to exit loop (_Fred must also be non zero) */
end;

do 3 until _Answer = "YES"
   /* Exits loop after 3 times or if _Answer becomes 'YES' */
end

do _Count = 1 to 10 until Fred == ""
   /* Loop 1 to 10 unless condition met */
end

do _Count = 1 to 10
   /* Looping 1 to 10 */

   /* Want to restart loop (don't execute following loop code)? */
   if _Restart = 'Y' then
      iterate;         /* Go back to start of loop (_Count incremented) */

   /* Want to exit loop early? */
   if _Flag = 'Y' | _State = 'R' then
      leave;           /* Exit loop */
end


email me  any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Search][Prev]: Rexx Conditional Logic[Next]: Rexx Parsing


PPWIZARD Manual
My whole website and this manual itself was developed using PPWIZARD (free preprocessor written by Dennis Bareis)
Saturday May 28 2022 at 2:55pm