Anonymous user
Loops/Continue: Difference between revisions
m
→{{header|REXX}}: added/changed comments and whitespace.
m (→version 1: added highlighting, forced a new line for the OUTPUT header.) |
m (→{{header|REXX}}: added/changed comments and whitespace.) |
||
Line 1,336:
===version 1===
(This program could be simpler by using a '''then/else''' construct, but an '''iterate''' was used to conform to the task.)
<lang rexx>/*REXX program illustrates an example of a DO loop with an ITERATE (continue). */
do j=1 for 10 /*this is equivalent to:
call charout , j /*write the integer to the terminal. */
if j//5\==0 then do /*Not a multiple of five? Then
call charout , ", " /* write a comma to the terminal, ··· */
iterate /*
end
say /*force REXX to display
end /*j*/
/*stick a fork in it, we're all done. */</lang>
Program note: the comma (<big><b>,</b></big>) immediately after the '''charout''' BIF indicates to use the terminal output stream.
Line 1,356:
===version 2===
<lang rexx>/*REXX program illustrates an example of a DO loop
$= /*nullify the variable used for display*/
do j=1 for 10 /*this is equivalent to:
$=$ || j', ' /*append the integer to a placeholder. */
if j//5==0 then say left($, length($) - 2)
if j==5 then $= /*start the display line over again. */
end /*j*/
/*stick a fork in it, we're all done. */</lang>
'''output''' is the same as the 1<sup>st</sup> REXX version. <br><br>
|