2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -1,8 +1,12 @@
|
|||
{{omit from|GUISS}}
|
||||
{{omit from|M4}}
|
||||
|
||||
;Task:
|
||||
Show the following output using one loop.
|
||||
1, 2, 3, 4, 5
|
||||
6, 7, 8, 9, 10
|
||||
|
||||
|
||||
Try to achieve the result by forcing the next iteration within the loop
|
||||
upon a specific condition, if your language allows it.
|
||||
<br><br>
|
||||
|
|
|
|||
5
Task/Loops-Continue/Io/loops-continue.io
Normal file
5
Task/Loops-Continue/Io/loops-continue.io
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
for(i,1,10,
|
||||
write(i)
|
||||
if(i%5 == 0, writeln() ; continue)
|
||||
write(" ,")
|
||||
)
|
||||
11
Task/Loops-Continue/REXX/loops-continue-1.rexx
Normal file
11
Task/Loops-Continue/REXX/loops-continue-1.rexx
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*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 integer.*/
|
||||
end
|
||||
say /*force REXX to display on next line. */
|
||||
end /*j*/
|
||||
/*stick a fork in it, we're all done. */
|
||||
8
Task/Loops-Continue/REXX/loops-continue-2.rexx
Normal file
8
Task/Loops-Continue/REXX/loops-continue-2.rexx
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
/*REXX program illustrates an example of a DO loop with an ITERATE (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? Then SAY.*/
|
||||
if j==5 then $= /*start the display line over again. */
|
||||
end /*j*/
|
||||
/*stick a fork in it, we're all done. */
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
/*REXX program illustrates a DO loop with an ITERATE (continue). */
|
||||
|
||||
do j=1 for 10 /*equivalent to: DO J=1 TO 10 */
|
||||
call charout , j /*write the integer to 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 int*/
|
||||
end
|
||||
say /*force REXX display to next line*/
|
||||
end /*j*/
|
||||
/*stick a fork in it, we're done.*/
|
||||
Loading…
Add table
Add a link
Reference in a new issue