Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
15
Task/Loops-Continue/Ada/loops-continue-1.adb
Normal file
15
Task/Loops-Continue/Ada/loops-continue-1.adb
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.adb
Normal file
18
Task/Loops-Continue/Ada/loops-continue-2.adb
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;
|
||||
|
|
@ -1,9 +1,12 @@
|
|||
set table to {return}
|
||||
set table to ""
|
||||
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
|
||||
repeat 1 times
|
||||
set table to table & i
|
||||
if i mod 5 = 0 then
|
||||
set table to table & return
|
||||
exit repeat
|
||||
end if
|
||||
set table to table & ", "
|
||||
end repeat
|
||||
end repeat
|
||||
return table as string
|
||||
return table
|
||||
|
|
|
|||
10
Task/Loops-Continue/Bait/loops-continue.bait
Normal file
10
Task/Loops-Continue/Bait/loops-continue.bait
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
fun main() {
|
||||
for i := 1; i <= 10; i += 1 {
|
||||
print(i)
|
||||
if i % 5 == 0 {
|
||||
println('')
|
||||
continue
|
||||
}
|
||||
print(', ')
|
||||
}
|
||||
}
|
||||
21
Task/Loops-Continue/COBOL/loops-continue.cob
Normal file
21
Task/Loops-Continue/COBOL/loops-continue.cob
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.chpl
Normal file
8
Task/Loops-Continue/Chapel/loops-continue.chpl
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
for i in 1..10 {
|
||||
write(i);
|
||||
if i % 5 == 0 then {
|
||||
writeln();
|
||||
continue;
|
||||
}
|
||||
write(", ");
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
for int i = 1; i <= 10; ++i
|
||||
for int i ← 1; i ≤ 10; ++i
|
||||
write(i)
|
||||
if i % 5 == 0
|
||||
if i % 5 æ 0
|
||||
writeLine()
|
||||
continue
|
||||
end
|
||||
|
|
|
|||
11
Task/Loops-Continue/Euphoria/loops-continue-1.eu
Normal file
11
Task/Loops-Continue/Euphoria/loops-continue-1.eu
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.eu
Normal file
18
Task/Loops-Continue/Euphoria/loops-continue-2.eu
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()
|
||||
8
Task/Loops-Continue/Haxe/loops-continue.hx
Normal file
8
Task/Loops-Continue/Haxe/loops-continue.hx
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
for (i in 1...11) {
|
||||
Sys.print(i);
|
||||
if (i % 5 == 0) {
|
||||
Sys.print('\n');
|
||||
continue;
|
||||
}
|
||||
Sys.print(', ');
|
||||
}
|
||||
5
Task/Loops-Continue/Jactl/loops-continue.jactl
Normal file
5
Task/Loops-Continue/Jactl/loops-continue.jactl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
for (i = 1; i < 11; i++) {
|
||||
print i
|
||||
println and continue if i % 5 == 0
|
||||
print ", "
|
||||
}
|
||||
9
Task/Loops-Continue/Oberon/loops-continue.oberon
Normal file
9
Task/Loops-Continue/Oberon/loops-continue.oberon
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
MODULE LoopsContinue;
|
||||
IMPORT Out;
|
||||
VAR i : INTEGER;
|
||||
BEGIN
|
||||
FOR i := 1 TO 10 DO
|
||||
Out.Int( i, 0 );
|
||||
IF i # 5 THEN Out.String( ", " ) ELSE Out.Ln END
|
||||
END
|
||||
END LoopsContinue.
|
||||
8
Task/Loops-Continue/PowerShell/loops-continue.ps1
Normal file
8
Task/Loops-Continue/PowerShell/loops-continue.ps1
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
for ($i = 1; $i -le 10; $i++) {
|
||||
Write-Host -NoNewline $i
|
||||
if ($i % 5 -eq 0) {
|
||||
Write-Host
|
||||
continue
|
||||
}
|
||||
Write-Host -NoNewline ", "
|
||||
}
|
||||
20
Task/Loops-Continue/Rebol/loops-continue-1.rebol
Normal file
20
Task/Loops-Continue/Rebol/loops-continue-1.rebol
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
REBOL [
|
||||
Title: "Loop/Continue"
|
||||
URL: http://rosettacode.org/wiki/Loop/Continue
|
||||
]
|
||||
|
||||
; REBOL2 does not provide a 'continue' word for loop constructs,
|
||||
; however, you may not even miss it:
|
||||
|
||||
print "One liner (compare to ALGOL 68 solution):"
|
||||
repeat i 10 [prin rejoin [i either 0 = mod i 5 [crlf][", "]]]
|
||||
|
||||
print [crlf "Port of ADA solution:"]
|
||||
for i 1 10 1 [
|
||||
prin i
|
||||
either 0 = mod i 5 [
|
||||
prin newline
|
||||
][
|
||||
prin ", "
|
||||
]
|
||||
]
|
||||
8
Task/Loops-Continue/Rebol/loops-continue-2.rebol
Normal file
8
Task/Loops-Continue/Rebol/loops-continue-2.rebol
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
repeat i 10 [
|
||||
prin i
|
||||
if zero? i % 5 [
|
||||
prin newline
|
||||
continue
|
||||
]
|
||||
prin ", "
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue