This commit is contained in:
Ingy döt Net 2013-10-27 22:24:23 +00:00
parent 6f050a029e
commit 776bba907c
3887 changed files with 59894 additions and 7280 deletions

View file

@ -0,0 +1,21 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. loop-continue.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 i PIC 99.
PROCEDURE DIVISION.
PERFORM VARYING i FROM 1 BY 1 UNTIL 10 < i
DISPLAY i WITH NO ADVANCING
IF FUNCTION MOD(i, 5) = 0
DISPLAY SPACE
EXIT PERFORM CYCLE
END-IF
DISPLAY ", " WITH NO ADVANCING
END-PERFORM
GOBACK
.

View file

@ -0,0 +1,8 @@
for i in 1..10 {
write(i);
if i % 5 == 0 then {
writeln();
continue;
}
write(", ");
}

View file

@ -1,10 +1,11 @@
/*REXX program to illustrate DO loop with an ITERATE (continue). */
/*REXX program illustrates a DO loop with an ITERATE (continue). */
do j=1 to 10
call charout , j", "
if j//5==0 then do
say
iterate
end
end /*j*/
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.*/

View file

@ -0,0 +1,4 @@
for (i <- 1 to 10) {
print(i)
if (i % 5 == 0) println() else print(", ")
}

View file

@ -0,0 +1,2 @@
val a = (1 to 10 /*1.*/ ).toList.splitAt(5) //2.
println(List(a._1, a._2) /*3.*/ .map(_.mkString(", ") /*4.*/ ).mkString("\n") /*5.*/ )