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: DO J=1 TO 10 */
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 /*... ··· & then go back for next intinteger.*/
end
say /*force REXX to display toon next line. */
end /*j*/
/*stick a fork in it, we're all done. */</lang>
Program note: &nbsp; the comma (<big><b>,</b></big>) immediately after the &nbsp; '''charout''' &nbsp; BIF indicates to use the terminal output stream.
 
Line 1,356:
 
===version 2===
<lang rexx>/*REXX program illustrates an example of a DO loop bywith buildingan a variableITERATE for each line(continue). */
$= /*nullify the variable used for display*/
do j=1 for 10 /*this is equivalent to: DO J=1 TO 10 */
$=$ || j', ' /*append the integer to a placeholder. */
if j//5==0 then say left($, length($) - 2) /*Is J a multiple of five? SayThen SAY.*/
if j==5 then $= /*start the display line over again. */
end /*j*/
/*stick a fork in it, we're all done. */</lang>
'''output''' &nbsp; is the same as the 1<sup>st</sup> REXX version. <br><br>