Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
5
Task/Loops-Continue/00-META.yaml
Normal file
5
Task/Loops-Continue/00-META.yaml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
category:
|
||||
- Loop modifiers
|
||||
from: http://rosettacode.org/wiki/Loops/Continue
|
||||
note: Iteration
|
||||
28
Task/Loops-Continue/00-TASK.txt
Normal file
28
Task/Loops-Continue/00-TASK.txt
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
;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.
|
||||
|
||||
|
||||
;Related tasks:
|
||||
* [[Loop over multiple arrays simultaneously]]
|
||||
* [[Loops/Break]]
|
||||
* [[Loops/Continue]]
|
||||
* [[Loops/Do-while]]
|
||||
* [[Loops/Downward for]]
|
||||
* [[Loops/For]]
|
||||
* [[Loops/For with a specified step]]
|
||||
* [[Loops/Foreach]]
|
||||
* [[Loops/Increment loop index within loop body]]
|
||||
* [[Loops/Infinite]]
|
||||
* [[Loops/N plus one half]]
|
||||
* [[Loops/Nested]]
|
||||
* [[Loops/While]]
|
||||
* [[Loops/with multiple ranges]]
|
||||
* [[Loops/Wrong ranges]]
|
||||
<br><br>
|
||||
|
||||
5
Task/Loops-Continue/11l/loops-continue.11l
Normal file
5
Task/Loops-Continue/11l/loops-continue.11l
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
L(i) 1..10
|
||||
I i % 5 == 0
|
||||
print(i)
|
||||
L.continue
|
||||
print(i, end' ‘, ’)
|
||||
32
Task/Loops-Continue/360-Assembly/loops-continue.360
Normal file
32
Task/Loops-Continue/360-Assembly/loops-continue.360
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
* Loops/Continue 12/08/2015
|
||||
LOOPCONT CSECT
|
||||
USING LOOPCONT,R12
|
||||
LR R12,R15
|
||||
BEGIN LA R8,0
|
||||
SR R5,R5
|
||||
LA R6,1
|
||||
LA R7,10
|
||||
LOOPI BXH R5,R6,ELOOPI for i=1 to 10
|
||||
LA R3,MVC(R8)
|
||||
XDECO R5,XDEC
|
||||
MVC 0(4,R3),XDEC+8
|
||||
LA R8,4(R8)
|
||||
LR R10,R5
|
||||
LA R1,5
|
||||
SRDA R10,32
|
||||
DR R10,R1
|
||||
LTR R10,R10
|
||||
BNZ COMMA
|
||||
XPRNT MVC,80
|
||||
LA R8,0
|
||||
B NEXTI
|
||||
COMMA LA R3,MVC(R8)
|
||||
MVC 0(2,R3),=C', '
|
||||
LA R8,2(R8)
|
||||
NEXTI B LOOPI next i
|
||||
ELOOPI XR R15,R15
|
||||
BR R14
|
||||
MVC DC CL80' '
|
||||
XDEC DS CL16
|
||||
YREGS
|
||||
END LOOPCONT
|
||||
9
Task/Loops-Continue/ALGOL-68/loops-continue.alg
Normal file
9
Task/Loops-Continue/ALGOL-68/loops-continue.alg
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
FOR i FROM 1 TO 10 DO
|
||||
print ((i,
|
||||
IF i MOD 5 = 0 THEN
|
||||
new line
|
||||
ELSE
|
||||
","
|
||||
FI
|
||||
))
|
||||
OD
|
||||
9
Task/Loops-Continue/ALGOL-W/loops-continue.alg
Normal file
9
Task/Loops-Continue/ALGOL-W/loops-continue.alg
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
begin
|
||||
i_w := 1; s_w := 0; % set output format %
|
||||
for i := 1 until 10 do begin
|
||||
writeon( i );
|
||||
if i rem 5 = 0
|
||||
then write()
|
||||
else writeon( ", " )
|
||||
end for_i
|
||||
end.
|
||||
10
Task/Loops-Continue/AWK/loops-continue.awk
Normal file
10
Task/Loops-Continue/AWK/loops-continue.awk
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
BEGIN {
|
||||
for(i=1; i <= 10; i++) {
|
||||
printf("%d", i)
|
||||
if ( i % 5 == 0 ) {
|
||||
print
|
||||
continue
|
||||
}
|
||||
printf(", ")
|
||||
}
|
||||
}
|
||||
15
Task/Loops-Continue/Ada/loops-continue-1.ada
Normal file
15
Task/Loops-Continue/Ada/loops-continue-1.ada
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
with Ada.Text_IO;
|
||||
use Ada.Text_IO;
|
||||
|
||||
procedure Loop_Continue is
|
||||
begin
|
||||
for I in 1..10 loop
|
||||
Put (Integer'Image(I));
|
||||
if I = 5 or I = 10 then
|
||||
New_Line;
|
||||
goto Continue;
|
||||
end if;
|
||||
Put (",");
|
||||
<<Continue>> --Ada 2012 no longer requires a statement after the label
|
||||
end loop;
|
||||
end Loop_Continue;
|
||||
18
Task/Loops-Continue/Ada/loops-continue-2.ada
Normal file
18
Task/Loops-Continue/Ada/loops-continue-2.ada
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
with Ada.Text_IO;
|
||||
use Ada.Text_IO;
|
||||
|
||||
procedure Loop_Continue is
|
||||
begin
|
||||
Print_All:
|
||||
for I in 1 .. 10 loop
|
||||
Print_Element: loop
|
||||
Put (Integer'Image(I));
|
||||
if I = 5 or I = 10 then
|
||||
New_Line;
|
||||
exit Print_Element;
|
||||
end if;
|
||||
Put (",");
|
||||
exit Print_Element;
|
||||
end loop Print_Element;
|
||||
end loop Print_All;
|
||||
end Loop_Continue;
|
||||
7
Task/Loops-Continue/Agena/loops-continue.agena
Normal file
7
Task/Loops-Continue/Agena/loops-continue.agena
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
for i to 10 do
|
||||
write( i );
|
||||
if i % 5 = 0
|
||||
then write( "\n" )
|
||||
else write( ", " )
|
||||
fi
|
||||
od
|
||||
8
Task/Loops-Continue/Aikido/loops-continue.aikido
Normal file
8
Task/Loops-Continue/Aikido/loops-continue.aikido
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
foreach i 1..10 {
|
||||
print (i)
|
||||
if ((i % 5) == 0) {
|
||||
println()
|
||||
continue
|
||||
}
|
||||
print (", ")
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
set table to {return}
|
||||
repeat with i from 1 to 10
|
||||
if i < 5 or (i ≥ 6 and i < 10) then
|
||||
set end of table to i & ", "
|
||||
else if i = 5 or i = 10 then
|
||||
set end of table to i & return
|
||||
end if
|
||||
end repeat
|
||||
return table as string
|
||||
5
Task/Loops-Continue/Applesoft-BASIC/loops-continue.basic
Normal file
5
Task/Loops-Continue/Applesoft-BASIC/loops-continue.basic
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
10 FOR I = 1 TO 10
|
||||
20 PRINT I;
|
||||
30 IF I - INT (I / 5) * 5 = 0 THEN PRINT : GOTO 50"CONTINUE
|
||||
40 PRINT ", ";
|
||||
50 NEXT
|
||||
8
Task/Loops-Continue/Arturo/loops-continue.arturo
Normal file
8
Task/Loops-Continue/Arturo/loops-continue.arturo
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
loop 1..10 'i [
|
||||
prints i
|
||||
if 0 = i%5 [
|
||||
print ""
|
||||
continue
|
||||
]
|
||||
prints ", "
|
||||
]
|
||||
9
Task/Loops-Continue/Asymptote/loops-continue.asymptote
Normal file
9
Task/Loops-Continue/Asymptote/loops-continue.asymptote
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
for(int i = 1; i <= 10; ++i) {
|
||||
write(i, suffix=none);
|
||||
if(i % 5 == 0) {
|
||||
write("");
|
||||
continue;
|
||||
} else {
|
||||
write(", ", suffix=none);
|
||||
}
|
||||
}
|
||||
5
Task/Loops-Continue/AutoHotkey/loops-continue.ahk
Normal file
5
Task/Loops-Continue/AutoHotkey/loops-continue.ahk
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
Loop, 10 {
|
||||
Delimiter := (A_Index = 5) || (A_Index = 10) ? "`n":", "
|
||||
Index .= A_Index . Delimiter
|
||||
}
|
||||
MsgBox %Index%
|
||||
10
Task/Loops-Continue/BASIC256/loops-continue.basic
Normal file
10
Task/Loops-Continue/BASIC256/loops-continue.basic
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
for i = 1 to 10
|
||||
print string(i);
|
||||
if i mod 5 = 0 then
|
||||
print
|
||||
continue for
|
||||
end if
|
||||
print ", ";
|
||||
next
|
||||
print
|
||||
end
|
||||
4
Task/Loops-Continue/BBC-BASIC/loops-continue.basic
Normal file
4
Task/Loops-Continue/BBC-BASIC/loops-continue.basic
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
FOR i% = 1 TO 10
|
||||
PRINT ; i% ;
|
||||
IF i% MOD 5 = 0 PRINT ELSE PRINT ", ";
|
||||
NEXT
|
||||
11
Task/Loops-Continue/BCPL/loops-continue.bcpl
Normal file
11
Task/Loops-Continue/BCPL/loops-continue.bcpl
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
get "libhdr"
|
||||
|
||||
let start() be
|
||||
for i = 1 to 10
|
||||
$( writen(i)
|
||||
if i rem 5 = 0
|
||||
$( wrch('*N')
|
||||
loop
|
||||
$)
|
||||
writes(", ")
|
||||
$)
|
||||
9
Task/Loops-Continue/Bc/loops-continue.bc
Normal file
9
Task/Loops-Continue/Bc/loops-continue.bc
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
for (i = 1; i <= 10; i++) {
|
||||
print i
|
||||
if (i % 5) {
|
||||
print ", "
|
||||
continue
|
||||
}
|
||||
print "\n"
|
||||
}
|
||||
quit
|
||||
6
Task/Loops-Continue/Befunge/loops-continue-1.bf
Normal file
6
Task/Loops-Continue/Befunge/loops-continue-1.bf
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
1>:56+\`#v_@
|
||||
+v %5:.:<
|
||||
1>#v_55+,v
|
||||
^ <
|
||||
>" ,",,v
|
||||
^ <
|
||||
6
Task/Loops-Continue/Befunge/loops-continue-2.bf
Normal file
6
Task/Loops-Continue/Befunge/loops-continue-2.bf
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
1>:56+\`#v_@
|
||||
+v5:,8.:<
|
||||
1>%#v_55+,v
|
||||
^ <
|
||||
>" ,",v
|
||||
^ ,<
|
||||
11
Task/Loops-Continue/Bracmat/loops-continue.bracmat
Normal file
11
Task/Loops-Continue/Bracmat/loops-continue.bracmat
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
( 0:?i
|
||||
& whl
|
||||
' ( 1+!i:~>10:?i
|
||||
& put
|
||||
$ ( str
|
||||
$ ( !i
|
||||
(mod$(!i.5):0&\n|", ")
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
8
Task/Loops-Continue/C++/loops-continue.cpp
Normal file
8
Task/Loops-Continue/C++/loops-continue.cpp
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
for(int i = 1;i <= 10; i++){
|
||||
cout << i;
|
||||
if(i % 5 == 0){
|
||||
cout << endl;
|
||||
continue;
|
||||
}
|
||||
cout << ", ";
|
||||
}
|
||||
16
Task/Loops-Continue/C-sharp/loops-continue.cs
Normal file
16
Task/Loops-Continue/C-sharp/loops-continue.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
|
||||
class Program {
|
||||
static void Main(string[] args) {
|
||||
for (int i = 1; i <= 10; i++) {
|
||||
Console.Write(i);
|
||||
|
||||
if (i % 5 == 0) {
|
||||
Console.WriteLine();
|
||||
continue;
|
||||
}
|
||||
|
||||
Console.Write(", ");
|
||||
}
|
||||
}
|
||||
}
|
||||
8
Task/Loops-Continue/C/loops-continue.c
Normal file
8
Task/Loops-Continue/C/loops-continue.c
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
for(int i = 1;i <= 10; i++){
|
||||
printf("%d", i);
|
||||
if(i % 5 == 0){
|
||||
printf("\n");
|
||||
continue;
|
||||
}
|
||||
printf(", ");
|
||||
}
|
||||
21
Task/Loops-Continue/COBOL/loops-continue.cobol
Normal file
21
Task/Loops-Continue/COBOL/loops-continue.cobol
Normal 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
|
||||
.
|
||||
8
Task/Loops-Continue/Chapel/loops-continue.chapel
Normal file
8
Task/Loops-Continue/Chapel/loops-continue.chapel
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
for i in 1..10 {
|
||||
write(i);
|
||||
if i % 5 == 0 then {
|
||||
writeln();
|
||||
continue;
|
||||
}
|
||||
write(", ");
|
||||
}
|
||||
8
Task/Loops-Continue/Clipper/loops-continue.clipper
Normal file
8
Task/Loops-Continue/Clipper/loops-continue.clipper
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
FOR i := 1 TO 10
|
||||
?? i
|
||||
IF i % 5 == 0
|
||||
?
|
||||
LOOP
|
||||
ENDIF
|
||||
?? ", "
|
||||
NEXT
|
||||
5
Task/Loops-Continue/Clojure/loops-continue-1.clj
Normal file
5
Task/Loops-Continue/Clojure/loops-continue-1.clj
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
(doseq [n (range 1 11)]
|
||||
(print n)
|
||||
(if (zero? (rem n 5))
|
||||
(println)
|
||||
(print ", ")))
|
||||
7
Task/Loops-Continue/Clojure/loops-continue-2.clj
Normal file
7
Task/Loops-Continue/Clojure/loops-continue-2.clj
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
(loop [xs (range 1 11)]
|
||||
(when-let [x (first xs)]
|
||||
(print x)
|
||||
(if (zero? (rem x 5))
|
||||
(println)
|
||||
(print ", "))
|
||||
(recur (rest xs))))
|
||||
12
Task/Loops-Continue/ColdFusion/loops-continue.cfm
Normal file
12
Task/Loops-Continue/ColdFusion/loops-continue.cfm
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<cfscript>
|
||||
for( i = 1; i <= 10; i++ )
|
||||
{
|
||||
writeOutput( i );
|
||||
if( 0 == i % 5 )
|
||||
{
|
||||
writeOutput( "< br />" );
|
||||
continue;
|
||||
}
|
||||
writeOutput( "," );
|
||||
}
|
||||
</cfscript>
|
||||
5
Task/Loops-Continue/Commodore-BASIC/loops-continue.basic
Normal file
5
Task/Loops-Continue/Commodore-BASIC/loops-continue.basic
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
10 FOR I = 1 to 10
|
||||
20 PRINT I;
|
||||
30 IF INT(I/5) = I/5 THEN PRINT : GOTO 50
|
||||
40 PRINT ", ";
|
||||
50 NEXT
|
||||
19
Task/Loops-Continue/Common-Lisp/loops-continue-1.lisp
Normal file
19
Task/Loops-Continue/Common-Lisp/loops-continue-1.lisp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
(do ((i 1 (1+ i)))
|
||||
((> i 10))
|
||||
(format t "~a~:[, ~;~%~]" i (zerop (mod i 5))))
|
||||
|
||||
(do ((i 1 (1+ i)))
|
||||
((> i 10))
|
||||
(write i)
|
||||
(when (zerop (mod i 5))
|
||||
(terpri)
|
||||
(go end))
|
||||
(write-string ", ")
|
||||
end)
|
||||
|
||||
(do ((i 1 (1+ i)))
|
||||
((> i 10))
|
||||
(write i)
|
||||
(if (zerop (mod i 5))
|
||||
(terpri)
|
||||
(write-string ", ")))
|
||||
14
Task/Loops-Continue/Common-Lisp/loops-continue-2.lisp
Normal file
14
Task/Loops-Continue/Common-Lisp/loops-continue-2.lisp
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
(loop for i from 1 to 10
|
||||
do (write i)
|
||||
if (zerop (mod i 5))
|
||||
do (terpri)
|
||||
else
|
||||
do (write-string ", "))
|
||||
|
||||
(loop for i from 1 to 10 do
|
||||
(block continue
|
||||
(write i)
|
||||
(when (zerop (mod i 5))
|
||||
(terpri)
|
||||
(return-from continue))
|
||||
(write-string ", ")))
|
||||
12
Task/Loops-Continue/Cowgol/loops-continue.cowgol
Normal file
12
Task/Loops-Continue/Cowgol/loops-continue.cowgol
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
include "cowgol.coh";
|
||||
|
||||
var n: uint8 := 0;
|
||||
while n < 10 loop
|
||||
n := n + 1;
|
||||
print_i8(n);
|
||||
if n % 5 == 0 then
|
||||
print_nl();
|
||||
continue;
|
||||
end if;
|
||||
print(", ");
|
||||
end loop;
|
||||
12
Task/Loops-Continue/D/loops-continue-1.d
Normal file
12
Task/Loops-Continue/D/loops-continue-1.d
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import std.stdio;
|
||||
|
||||
void main() {
|
||||
foreach (i; 1 .. 11) {
|
||||
write(i);
|
||||
if (i % 5 == 0) {
|
||||
writeln();
|
||||
continue;
|
||||
}
|
||||
write(", ");
|
||||
}
|
||||
}
|
||||
6
Task/Loops-Continue/D/loops-continue-2.d
Normal file
6
Task/Loops-Continue/D/loops-continue-2.d
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import std.stdio;
|
||||
|
||||
void main()
|
||||
{
|
||||
foreach(i; 1..11) i % 5 ? writef("%s, ", i) : writeln(i);
|
||||
}
|
||||
10
Task/Loops-Continue/DWScript/loops-continue.dw
Normal file
10
Task/Loops-Continue/DWScript/loops-continue.dw
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
var i : Integer;
|
||||
|
||||
for i := 1 to 10 do begin
|
||||
Print(i);
|
||||
if i mod 5 = 0 then begin
|
||||
PrintLn('');
|
||||
continue;
|
||||
end;
|
||||
Print(', ');
|
||||
end;
|
||||
12
Task/Loops-Continue/Dc/loops-continue.dc
Normal file
12
Task/Loops-Continue/Dc/loops-continue.dc
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
1 si # i = 1
|
||||
[2Q]sA # A = code to break loop
|
||||
[[, ]P 1J]sB # B = code to print comma, continue loop
|
||||
[
|
||||
li n # print i
|
||||
li 5 % 0 !=B # call B if i % 5
|
||||
[
|
||||
]P # print newline
|
||||
M # mark from calling B
|
||||
li 1 + si # i += 1
|
||||
li 10!<C # continue loop if 10 >= i
|
||||
]sC li 10!<C # enter loop if 10 >= i
|
||||
15
Task/Loops-Continue/Delphi/loops-continue.delphi
Normal file
15
Task/Loops-Continue/Delphi/loops-continue.delphi
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
program DoLoop(output);
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
for i := 1 to 10 do
|
||||
begin
|
||||
write(i);
|
||||
if i mod 5 = 0 then
|
||||
begin
|
||||
writeln;
|
||||
continue;
|
||||
end;
|
||||
write(', ');
|
||||
end;
|
||||
end.
|
||||
8
Task/Loops-Continue/Dyalect/loops-continue.dyalect
Normal file
8
Task/Loops-Continue/Dyalect/loops-continue.dyalect
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
for i in 1..10 {
|
||||
print(i, terminator: "")
|
||||
if i % 5 == 0 {
|
||||
print()
|
||||
continue
|
||||
}
|
||||
print(", ", terminator: "")
|
||||
}
|
||||
8
Task/Loops-Continue/EMal/loops-continue.emal
Normal file
8
Task/Loops-Continue/EMal/loops-continue.emal
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
for int i = 1; i <= 10; ++i
|
||||
write(i)
|
||||
if i % 5 == 0
|
||||
writeLine()
|
||||
continue
|
||||
end
|
||||
write(", ")
|
||||
end
|
||||
10
Task/Loops-Continue/ERRE/loops-continue.erre
Normal file
10
Task/Loops-Continue/ERRE/loops-continue.erre
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
FOR I=1 TO 10 DO
|
||||
PRINT(I;CHR$(29);) ! printing a numeric value leaves a blank after it
|
||||
! chr$(29) delete it.....
|
||||
IF I MOD 5=0 THEN
|
||||
PRINT
|
||||
CONTINUE FOR
|
||||
END IF
|
||||
PRINT(",";)
|
||||
END FOR
|
||||
PRINT
|
||||
13
Task/Loops-Continue/Ela/loops-continue-1.ela
Normal file
13
Task/Loops-Continue/Ela/loops-continue-1.ela
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
open monad io
|
||||
|
||||
loop n =
|
||||
if n > 10 then do
|
||||
return ()
|
||||
else do
|
||||
putStr (show n)
|
||||
putStr f
|
||||
loop (n + 1)
|
||||
where f | n % 5 == 0 = "\r\n"
|
||||
| else = ", "
|
||||
|
||||
_ = loop 1 ::: IO
|
||||
11
Task/Loops-Continue/Ela/loops-continue-2.ela
Normal file
11
Task/Loops-Continue/Ela/loops-continue-2.ela
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
open monad io
|
||||
|
||||
loop [] = return ()
|
||||
loop (x::xs) = do
|
||||
putStr (show x)
|
||||
putStr f
|
||||
loop xs
|
||||
where f | x % 5 == 0 = "\r\n"
|
||||
| else = ", "
|
||||
|
||||
_ = loop [1..10] ::: IO
|
||||
10
Task/Loops-Continue/Elixir/loops-continue.elixir
Normal file
10
Task/Loops-Continue/Elixir/loops-continue.elixir
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
defmodule Loops do
|
||||
def continue do
|
||||
Enum.each(1..10, fn i ->
|
||||
IO.write i
|
||||
IO.write if rem(i,5)==0, do: "\n", else: ", "
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
Loops.continue
|
||||
21
Task/Loops-Continue/Erlang/loops-continue.erl
Normal file
21
Task/Loops-Continue/Erlang/loops-continue.erl
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
%% Implemented by Arjun Sunel
|
||||
-module(continue).
|
||||
-export([main/0, for_loop/1]).
|
||||
|
||||
main() ->
|
||||
for_loop(1).
|
||||
|
||||
for_loop(N) when N /= 5 , N <10 ->
|
||||
io:format("~p, ",[N] ),
|
||||
for_loop(N+1);
|
||||
|
||||
for_loop(N) when N >=10->
|
||||
if N=:=10 ->
|
||||
io:format("~p\n",[N] )
|
||||
end;
|
||||
|
||||
for_loop(N) ->
|
||||
if N=:=5 ->
|
||||
io:format("~p\n",[N] ),
|
||||
for_loop(N+1)
|
||||
end.
|
||||
11
Task/Loops-Continue/Euphoria/loops-continue-1.euphoria
Normal file
11
Task/Loops-Continue/Euphoria/loops-continue-1.euphoria
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
include std\console.e --only for any_key to make running command window easier on windows
|
||||
|
||||
for i = 1 to 10 do
|
||||
if remainder(i,5) = 0 then
|
||||
printf(1, "%d\n", i)
|
||||
else
|
||||
printf(1,"%d, ", i)
|
||||
continue
|
||||
end if
|
||||
end for
|
||||
any_key()
|
||||
18
Task/Loops-Continue/Euphoria/loops-continue-2.euphoria
Normal file
18
Task/Loops-Continue/Euphoria/loops-continue-2.euphoria
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
include std\console.e --only for any_key to make running command window easier on windows
|
||||
|
||||
for i = 1 to 10 do
|
||||
if remainder(i,5) = 0 then
|
||||
switch i do
|
||||
case 10 then
|
||||
printf(1,"%d ",i)
|
||||
break --new to euphoria 4.0.0+
|
||||
case else
|
||||
printf(1,"%d\n", i)
|
||||
end switch
|
||||
|
||||
else
|
||||
printf(1,"%d, ", i)
|
||||
continue --new to euphoria 4.0.0+
|
||||
end if
|
||||
end for
|
||||
any_key()
|
||||
6
Task/Loops-Continue/F-Sharp/loops-continue-1.fs
Normal file
6
Task/Loops-Continue/F-Sharp/loops-continue-1.fs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
for i in 1 .. 10 do
|
||||
printf "%d" i
|
||||
if i % 5 = 0 then
|
||||
printf "\n"
|
||||
else
|
||||
printf ", "
|
||||
5
Task/Loops-Continue/F-Sharp/loops-continue-2.fs
Normal file
5
Task/Loops-Continue/F-Sharp/loops-continue-2.fs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
let fN g=quibble (Seq.initInfinite(fun n ->if (n+1)%5=0 || (n+1)=List.length g then "\n" else ", ")) g
|
||||
fN [1] |> Seq.iter(fun(n,g)->printf "%d%s" n g)
|
||||
fN [1..9] |> Seq.iter(fun(n,g)->printf "%d%s" n g)
|
||||
fN [1..10] |> Seq.iter(fun(n,g)->printf "%d%s" n g)
|
||||
fN [1..11] |> Seq.iter(fun(n,g)->printf "%d%s" n g)
|
||||
4
Task/Loops-Continue/Factor/loops-continue.factor
Normal file
4
Task/Loops-Continue/Factor/loops-continue.factor
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
1 10 [a,b] [
|
||||
[ number>string write ]
|
||||
[ 5 mod 0 = "\n" ", " ? write ] bi
|
||||
] each
|
||||
17
Task/Loops-Continue/Fantom/loops-continue.fantom
Normal file
17
Task/Loops-Continue/Fantom/loops-continue.fantom
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
class LoopsContinue
|
||||
{
|
||||
public static Void main ()
|
||||
{
|
||||
for (Int i := 1; i <= 10; ++i)
|
||||
{
|
||||
Env.cur.out.print (i)
|
||||
if (i % 5 == 0)
|
||||
{
|
||||
Env.cur.out.printLine ("")
|
||||
continue
|
||||
}
|
||||
Env.cur.out.print (", ")
|
||||
}
|
||||
Env.cur.out.printLine ("")
|
||||
}
|
||||
}
|
||||
5
Task/Loops-Continue/Forth/loops-continue.fth
Normal file
5
Task/Loops-Continue/Forth/loops-continue.fth
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
: main
|
||||
11 1 do
|
||||
i dup 1 r.
|
||||
5 mod 0= if cr else [char] , emit space then
|
||||
loop ;
|
||||
8
Task/Loops-Continue/Fortran/loops-continue-1.f
Normal file
8
Task/Loops-Continue/Fortran/loops-continue-1.f
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
do i = 1, 10
|
||||
write(*, '(I0)', advance='no') i
|
||||
if ( mod(i, 5) == 0 ) then
|
||||
write(*,*)
|
||||
cycle
|
||||
end if
|
||||
write(*, '(A)', advance='no') ', '
|
||||
end do
|
||||
67
Task/Loops-Continue/Fortran/loops-continue-2.f
Normal file
67
Task/Loops-Continue/Fortran/loops-continue-2.f
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
C WARNING: This program is not valid ANSI FORTRAN 77 code. It uses
|
||||
C one nonstandard character on the line labelled 5001. Many F77
|
||||
C compilers should be okay with it, but it is *not* standard.
|
||||
C
|
||||
C It is also worth noting that FORTRAN 77 uses the command CONTINUE,
|
||||
C but not in the semantic, looping sense of the word. In FORTRAN,
|
||||
C CONTINUE means "do absolutely nothing." It is a placeholder. If
|
||||
C anything, it means "continue to the next line."
|
||||
C
|
||||
C Python does the same thing with `pass`; C and its family of
|
||||
C languages, with `{/* do nothing */}`. Write CONTINUE when you need
|
||||
C to write something but have nothing to write.
|
||||
C
|
||||
C This page on Rosetta Code is about a very different "continue"
|
||||
C statement that tells a loop to go back to the beginning. In
|
||||
C FORTRAN, we use (you guessed it!) a GOTO to accomplish this.
|
||||
PROGRAM CONTINUELOOP
|
||||
INTEGER I
|
||||
|
||||
DO 10 I = 1, 10
|
||||
C Is it five or ten?
|
||||
IF (MOD(I, 5) .EQ. 0) THEN
|
||||
C If it is, write a newline and no comma.
|
||||
WRITE (*,5000) I
|
||||
|
||||
C Continue the loop; that is, skip to the end of the loop.
|
||||
GOTO 10
|
||||
ENDIF
|
||||
|
||||
C Write I with a comma and no newline.
|
||||
WRITE (*,5001) I
|
||||
|
||||
C Again, in this case, CONTINUE is completely unrelated to the
|
||||
C semantic, looping sense of the word.
|
||||
10 CONTINUE
|
||||
|
||||
STOP
|
||||
|
||||
C This will print an integer and a newline (no comma).
|
||||
5000 FORMAT (I3)
|
||||
|
||||
C Standard FORTRAN 77 is completely incapable of completing a
|
||||
C WRITE statement without printing a newline. If you want to print
|
||||
C five integers in standard code, you have to do something like
|
||||
C this:
|
||||
C
|
||||
C FORMAT (I3, ',', I3, ',', I3, ',', I3, ',', I3)
|
||||
C
|
||||
C Writing `1, 2, 3, 4, 5` and then `6, 7, 8, 9, 10` to that format
|
||||
C would produce the following two lines:
|
||||
C
|
||||
C 1, 2, 3, 4, 5
|
||||
C 6, 7, 8, 9, 10
|
||||
C
|
||||
C However, this code exists to demonstrate continuing a FORTRAN 77
|
||||
C loop and not to demonstrate how to get around its rigidity about
|
||||
C newlines.
|
||||
C
|
||||
C The dollar sign at the end of the format is a nonstandard
|
||||
C character. It tells the compiler not to print a newline. If you
|
||||
C are actually using FORTRAN 77, you should figure out what your
|
||||
C particular compiler accepts. If you are actually using Fortran
|
||||
C 90 or later, you should replace this line with the commented
|
||||
C line that follows it.
|
||||
5001 FORMAT (I3, ',', $)
|
||||
C5001 FORMAT (I3, ',', ADVANCE='NO')
|
||||
END
|
||||
3
Task/Loops-Continue/Fortran/loops-continue-3.f
Normal file
3
Task/Loops-Continue/Fortran/loops-continue-3.f
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
WRITE (6,1) (I,I = 1,10)
|
||||
1 FORMAT (4(1X,I0,","),1X,I0)
|
||||
END
|
||||
12
Task/Loops-Continue/FreeBASIC/loops-continue.basic
Normal file
12
Task/Loops-Continue/FreeBASIC/loops-continue.basic
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
' FB 1.05.0 Win64
|
||||
For i As Integer = 1 To 10
|
||||
Print Str(i);
|
||||
If i Mod 5 = 0 Then
|
||||
Print
|
||||
Continue For
|
||||
End If
|
||||
Print ", ";
|
||||
Next
|
||||
|
||||
Print
|
||||
Sleep
|
||||
13
Task/Loops-Continue/FutureBasic/loops-continue.basic
Normal file
13
Task/Loops-Continue/FutureBasic/loops-continue.basic
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
include "NSLog.incl"
|
||||
|
||||
long num
|
||||
|
||||
for num = 1 to 10
|
||||
if ( num mod 5 )
|
||||
NSLog(@"%ld, \b",num)
|
||||
else
|
||||
NSLog(@"%ld",num)
|
||||
end if
|
||||
next
|
||||
|
||||
HandleEvents
|
||||
10
Task/Loops-Continue/GAP/loops-continue.gap
Normal file
10
Task/Loops-Continue/GAP/loops-continue.gap
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
for i in [1 .. 11] do
|
||||
if RemInt(i, 5) = 0 then
|
||||
Print(i, "\n");
|
||||
continue;
|
||||
fi;
|
||||
Print(i, ", ");
|
||||
od;
|
||||
|
||||
# 1, 2, 3, 4, 5
|
||||
# 6, 7, 8, 9, 10
|
||||
11
Task/Loops-Continue/GDScript/loops-continue.gd
Normal file
11
Task/Loops-Continue/GDScript/loops-continue.gd
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
extends MainLoop
|
||||
|
||||
|
||||
func _process(_delta: float) -> bool:
|
||||
for i in range(1,11):
|
||||
if i % 5 == 0:
|
||||
print(i)
|
||||
continue
|
||||
printraw(i, ", ")
|
||||
|
||||
return true # Exit
|
||||
7
Task/Loops-Continue/GML/loops-continue.gml
Normal file
7
Task/Loops-Continue/GML/loops-continue.gml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
for(i = 1; i <= 10; i += 1)
|
||||
{
|
||||
show_message(string(i))
|
||||
i += 1
|
||||
if(i <= 10)
|
||||
continue
|
||||
}
|
||||
10
Task/Loops-Continue/Gambas/loops-continue.gambas
Normal file
10
Task/Loops-Continue/Gambas/loops-continue.gambas
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
Public Sub Main()
|
||||
Dim siCount As Short
|
||||
|
||||
For siCount = 1 To 10
|
||||
Print siCount;
|
||||
If siCount <> 5 And siCount <> 10 Then Print ",";
|
||||
If siCount = 5 Then Print gb.NewLine;
|
||||
Next
|
||||
|
||||
End
|
||||
14
Task/Loops-Continue/Go/loops-continue.go
Normal file
14
Task/Loops-Continue/Go/loops-continue.go
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
for i := 1; i <= 10; i++ {
|
||||
fmt.Printf("%d", i)
|
||||
if i%5 == 0 {
|
||||
fmt.Printf("\n")
|
||||
continue
|
||||
}
|
||||
fmt.Printf(", ")
|
||||
}
|
||||
}
|
||||
8
Task/Loops-Continue/Groovy/loops-continue.groovy
Normal file
8
Task/Loops-Continue/Groovy/loops-continue.groovy
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
for (i in 1..10) {
|
||||
print i
|
||||
if (i % 5 == 0) {
|
||||
println ()
|
||||
continue
|
||||
}
|
||||
print ', '
|
||||
}
|
||||
5
Task/Loops-Continue/Haskell/loops-continue.hs
Normal file
5
Task/Loops-Continue/Haskell/loops-continue.hs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import Control.Monad (forM)
|
||||
main = forM [1..10] out
|
||||
where
|
||||
out x | x `mod` 5 == 0 = print x
|
||||
| otherwise = (putStr . (++", ") . show) x
|
||||
8
Task/Loops-Continue/Haxe/loops-continue.haxe
Normal file
8
Task/Loops-Continue/Haxe/loops-continue.haxe
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
for (i in 1...11) {
|
||||
Sys.print(i);
|
||||
if (i % 5 == 0) {
|
||||
Sys.print('\n');
|
||||
continue;
|
||||
}
|
||||
Sys.print(', ');
|
||||
}
|
||||
7
Task/Loops-Continue/HicEst/loops-continue.hicest
Normal file
7
Task/Loops-Continue/HicEst/loops-continue.hicest
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
DO i = 1, 10
|
||||
IF( MOD(i, 5) == 1 ) THEN
|
||||
WRITE(Format="i3") i
|
||||
ELSE
|
||||
WRITE(APPend, Format=" ',', i3 ") i
|
||||
ENDIF
|
||||
ENDDO
|
||||
8
Task/Loops-Continue/IS-BASIC/loops-continue.basic
Normal file
8
Task/Loops-Continue/IS-BASIC/loops-continue.basic
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
100 FOR I=1 TO 10
|
||||
110 PRINT STR$(I);
|
||||
120 IF MOD(I,5)=0 THEN
|
||||
130 PRINT
|
||||
140 ELSE
|
||||
150 PRINT ", ";
|
||||
160 END IF
|
||||
170 NEXT
|
||||
9
Task/Loops-Continue/Icon/loops-continue-1.icon
Normal file
9
Task/Loops-Continue/Icon/loops-continue-1.icon
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
procedure main()
|
||||
every writes(x := 1 to 10) do {
|
||||
if x % 5 = 0 then {
|
||||
write()
|
||||
next
|
||||
}
|
||||
writes(", ")
|
||||
}
|
||||
end
|
||||
1
Task/Loops-Continue/Icon/loops-continue-2.icon
Normal file
1
Task/Loops-Continue/Icon/loops-continue-2.icon
Normal file
|
|
@ -0,0 +1 @@
|
|||
every writes(x := 1 to 10, if x % 5 = 0 then "\n" else ", ")
|
||||
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(" ,")
|
||||
)
|
||||
1
Task/Loops-Continue/J/loops-continue-1.j
Normal file
1
Task/Loops-Continue/J/loops-continue-1.j
Normal file
|
|
@ -0,0 +1 @@
|
|||
_2}."1'lq<, >'8!:2>:i.2 5
|
||||
15
Task/Loops-Continue/J/loops-continue-2.j
Normal file
15
Task/Loops-Continue/J/loops-continue-2.j
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
3 : 0 ] 10
|
||||
z=.''
|
||||
for_i. 1 + i.y do.
|
||||
z =. z , ": i
|
||||
|
||||
if. 0 = 5 | i do.
|
||||
z 1!:2 ]2
|
||||
z =. ''
|
||||
continue.
|
||||
end.
|
||||
|
||||
z =. z , ', '
|
||||
end.
|
||||
i.0 0
|
||||
)
|
||||
9
Task/Loops-Continue/Jakt/loops-continue.jakt
Normal file
9
Task/Loops-Continue/Jakt/loops-continue.jakt
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
fn main() {
|
||||
for i in 1..11 {
|
||||
if i % 5 == 0 {
|
||||
println("{}", i)
|
||||
continue
|
||||
}
|
||||
print("{}, ", i)
|
||||
}
|
||||
}
|
||||
8
Task/Loops-Continue/Java/loops-continue.java
Normal file
8
Task/Loops-Continue/Java/loops-continue.java
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
for(int i = 1;i <= 10; i++){
|
||||
System.out.print(i);
|
||||
if(i % 5 == 0){
|
||||
System.out.println();
|
||||
continue;
|
||||
}
|
||||
System.out.print(", ");
|
||||
}
|
||||
10
Task/Loops-Continue/JavaScript/loops-continue-1.js
Normal file
10
Task/Loops-Continue/JavaScript/loops-continue-1.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
var output = "";
|
||||
for (var i = 1; i <= 10; i++) {
|
||||
output += i;
|
||||
if (i % 5 == 0) {
|
||||
print(output);
|
||||
output = "";
|
||||
continue;
|
||||
}
|
||||
output += ", ";
|
||||
}
|
||||
11
Task/Loops-Continue/JavaScript/loops-continue-2.js
Normal file
11
Task/Loops-Continue/JavaScript/loops-continue-2.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
function rng(n) {
|
||||
return n ? rng(n - 1).concat(n) : [];
|
||||
}
|
||||
|
||||
console.log(
|
||||
rng(10).reduce(
|
||||
function (a, x) {
|
||||
return a + x.toString() + (x % 5 ? ', ' : '\n');
|
||||
}, ''
|
||||
)
|
||||
);
|
||||
2
Task/Loops-Continue/JavaScript/loops-continue-3.js
Normal file
2
Task/Loops-Continue/JavaScript/loops-continue-3.js
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
1, 2, 3, 4, 5
|
||||
6, 7, 8, 9, 10
|
||||
2
Task/Loops-Continue/Jq/loops-continue.jq
Normal file
2
Task/Loops-Continue/Jq/loops-continue.jq
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
reduce range(1;11) as $i
|
||||
(""; . + "\($i)" + (if $i % 5 == 0 then "\n" else ", " end))
|
||||
9
Task/Loops-Continue/Jsish/loops-continue.jsish
Normal file
9
Task/Loops-Continue/Jsish/loops-continue.jsish
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/* Loop/continue in jsish */
|
||||
for (var i = 1; i <= 10; i++) {
|
||||
printf("%d", i);
|
||||
if (i % 5 == 0) {
|
||||
printf("\n");
|
||||
continue;
|
||||
}
|
||||
printf(", ");
|
||||
}
|
||||
8
Task/Loops-Continue/Julia/loops-continue.julia
Normal file
8
Task/Loops-Continue/Julia/loops-continue.julia
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
for i in 1:10
|
||||
print(i)
|
||||
if i%5 == 0
|
||||
println()
|
||||
continue
|
||||
end
|
||||
print(", ")
|
||||
end
|
||||
11
Task/Loops-Continue/Kotlin/loops-continue.kotlin
Normal file
11
Task/Loops-Continue/Kotlin/loops-continue.kotlin
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
// version 1.1.2
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
for(i in 1 .. 10) {
|
||||
if (i % 5 == 0) {
|
||||
println(i)
|
||||
continue
|
||||
}
|
||||
print("$i, ")
|
||||
}
|
||||
}
|
||||
12
Task/Loops-Continue/Lambdatalk/loops-continue.lambdatalk
Normal file
12
Task/Loops-Continue/Lambdatalk/loops-continue.lambdatalk
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{def loops_continue
|
||||
{lambda {:i}
|
||||
{if {> :i 10}
|
||||
then (end of loop)
|
||||
else {if {= :i 6} then {br}:i else :i}
|
||||
{if {= :i 10} then . else ,}
|
||||
{loops_continue {+ :i 1}}}}}
|
||||
-> loops_continue
|
||||
|
||||
{loops_continue 0}
|
||||
-> 0, 1, 2, 3, 4, 5,
|
||||
6, 7, 8, 9, 10. (end of loop)
|
||||
12
Task/Loops-Continue/Lang/loops-continue.lang
Normal file
12
Task/Loops-Continue/Lang/loops-continue.lang
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
$i = 0
|
||||
while($i < 10) {
|
||||
$i += 1
|
||||
|
||||
if($i % 5 === 0) {
|
||||
fn.println($i)
|
||||
|
||||
con.continue
|
||||
}
|
||||
|
||||
fn.print($i\,\s)
|
||||
}
|
||||
5
Task/Loops-Continue/Langur/loops-continue.langur
Normal file
5
Task/Loops-Continue/Langur/loops-continue.langur
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
for .i of 10 {
|
||||
write .i
|
||||
if .i div 5 { writeln(); next }
|
||||
write ", "
|
||||
}
|
||||
6
Task/Loops-Continue/Lasso/loops-continue.lasso
Normal file
6
Task/Loops-Continue/Lasso/loops-continue.lasso
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
loop(10) => {^
|
||||
loop_count
|
||||
loop_count % 5 ? ', ' | '\r'
|
||||
loop_count < 100 ? loop_continue
|
||||
'Hello, World!' // never gets executed
|
||||
^}
|
||||
4
Task/Loops-Continue/Liberty-BASIC/loops-continue.basic
Normal file
4
Task/Loops-Continue/Liberty-BASIC/loops-continue.basic
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
for i =1 to 10
|
||||
if i mod 5 <>0 then print i; ", "; else print i
|
||||
next i
|
||||
end
|
||||
10
Task/Loops-Continue/Lingo/loops-continue.lingo
Normal file
10
Task/Loops-Continue/Lingo/loops-continue.lingo
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
str = ""
|
||||
repeat with i = 1 to 10
|
||||
put i after str
|
||||
if i mod 5 = 0 then
|
||||
put RETURN after str
|
||||
next repeat
|
||||
end if
|
||||
put ", " after str
|
||||
end repeat
|
||||
put str
|
||||
4
Task/Loops-Continue/Lisaac/loops-continue.lisaac
Normal file
4
Task/Loops-Continue/Lisaac/loops-continue.lisaac
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
1.to 10 do { i : INTEGER;
|
||||
i.print;
|
||||
(i % 5 = 0).if { '\n'.print; } else { ','.print; };
|
||||
};
|
||||
5
Task/Loops-Continue/LiveCode/loops-continue.livecode
Normal file
5
Task/Loops-Continue/LiveCode/loops-continue.livecode
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
repeat with n = 1 to 10
|
||||
put n
|
||||
if n is 5 then put return
|
||||
if n < 10 and n is not 5 then put ","
|
||||
end repeat
|
||||
8
Task/Loops-Continue/Lua/loops-continue-1.lua
Normal file
8
Task/Loops-Continue/Lua/loops-continue-1.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
for i = 1, 10 do
|
||||
io.write( i )
|
||||
if i % 5 == 0 then
|
||||
io.write( "\n" )
|
||||
else
|
||||
io.write( ", " )
|
||||
end
|
||||
end
|
||||
9
Task/Loops-Continue/Lua/loops-continue-2.lua
Normal file
9
Task/Loops-Continue/Lua/loops-continue-2.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
for i = 1, 10 do
|
||||
io.write( i )
|
||||
if i % 5 == 0 then
|
||||
io.write( "\n" )
|
||||
goto continue
|
||||
end
|
||||
io.write( ", " )
|
||||
::continue::
|
||||
end
|
||||
36
Task/Loops-Continue/M2000-Interpreter/loops-continue.m2000
Normal file
36
Task/Loops-Continue/M2000-Interpreter/loops-continue.m2000
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
Module Checkit {
|
||||
\\ A For {} loop
|
||||
For i=1 to 10 {
|
||||
Print i;
|
||||
if i mod 5 Else Print : continue
|
||||
Print ",";
|
||||
}
|
||||
Print i=11
|
||||
\\ A For Next loop
|
||||
For i=1 to 10
|
||||
Print i;
|
||||
if i mod 5 Else Print : continue
|
||||
Print ",";
|
||||
Next i
|
||||
Print i=11
|
||||
\\ A for loop using a block and a Loop statement
|
||||
i=0
|
||||
{ i++
|
||||
if i>10 then Exit
|
||||
loop
|
||||
Print i;
|
||||
if i mod 5 Else Print : continue
|
||||
Print ",";
|
||||
}
|
||||
Print i=11
|
||||
\\ as above but end value for i=10 not 11
|
||||
i=0
|
||||
{ i++
|
||||
if i<10 then loop
|
||||
Print i;
|
||||
if i mod 5 Else Print : continue
|
||||
Print ",";
|
||||
}
|
||||
Print i=10 ' not 11 but 10
|
||||
}
|
||||
Checkit
|
||||
1
Task/Loops-Continue/MATLAB/loops-continue-1.m
Normal file
1
Task/Loops-Continue/MATLAB/loops-continue-1.m
Normal file
|
|
@ -0,0 +1 @@
|
|||
disp([1:5; 6:10])
|
||||
1
Task/Loops-Continue/MATLAB/loops-continue-2.m
Normal file
1
Task/Loops-Continue/MATLAB/loops-continue-2.m
Normal file
|
|
@ -0,0 +1 @@
|
|||
disp(reshape([1:10],5,2)')
|
||||
7
Task/Loops-Continue/MATLAB/loops-continue-3.m
Normal file
7
Task/Loops-Continue/MATLAB/loops-continue-3.m
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
for i = 1:10
|
||||
printf(' %2d', i);
|
||||
if ( mod(i, 5) == 0 )
|
||||
printf('\n');
|
||||
continue
|
||||
end
|
||||
end
|
||||
10
Task/Loops-Continue/MAXScript/loops-continue.max
Normal file
10
Task/Loops-Continue/MAXScript/loops-continue.max
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
for i in 1 to 10 do
|
||||
(
|
||||
format "%" i
|
||||
if mod i 5 == 0 then
|
||||
(
|
||||
format "\n"
|
||||
continue
|
||||
) continue
|
||||
format ", "
|
||||
)
|
||||
10
Task/Loops-Continue/MOO/loops-continue.moo
Normal file
10
Task/Loops-Continue/MOO/loops-continue.moo
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
s = "";
|
||||
for i in [1..10]
|
||||
s += tostr(i);
|
||||
if (i % 5 == 0)
|
||||
player:tell(s);
|
||||
s = "";
|
||||
continue;
|
||||
endif
|
||||
s += ", ";
|
||||
endfor
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue