Loops/While: Difference between revisions

→‎version 3, faster WHILE comparison: added another REXX version. -- ~~~~
m (→‎{{header|REXX}}: expanded and aligned the initial REXX program comment(s). -- ~~~)
(→‎version 3, faster WHILE comparison: added another REXX version. -- ~~~~)
Line 1,138:
say right(x,10) /*pretty output by aligning right*/
x=x%2 /*in REXX, % is integer division.*/
end
/*stick a fork in it, we're done.*/</lang>
'''output''' is the same as version 2.
<br><br>
 
===version 4, index reduction===
<lang rexx>/*REXX program demonstrates a DO WHILE with index reduction construct.*/
 
do j=1024 by 0 while j>>0 /*this is an exact comparison. */
say right(j,10) /*pretty output by aligning right*/
j=j%2 /*in REXX, % is integer division.*/
end
/*stick a fork in it, we're done.*/</lang>