langs a-z

This commit is contained in:
Ingy döt Net 2013-04-10 22:43:41 -07:00
parent db842d013d
commit d066446780
11389 changed files with 98361 additions and 1020 deletions

View file

@ -0,0 +1,16 @@
using System;
using System.Console;
using Nemerle.Imperative;
module Continue
{
Main() : void
{
foreach (i in [1 .. 10])
{
Write(i);
when (i % 5 == 0) {WriteLine(); continue;}
Write(", ");
}
}
}

View file

@ -0,0 +1,16 @@
/* NetRexx */
options replace format comments java crossref savelog symbols nobinary
say
say 'Loops/Continue'
nul = '\-'
loop i_ = 1 to 10
say i_.right(2) || nul
if i_ // 5 = 0 then do
say
iterate i_
end
say ', ' || nul
end i_

View file

@ -0,0 +1,12 @@
# for i = 1 to 10 do
try
print_int i;
if (i mod 5) = 0 then raise Exit;
print_string ", "
with Exit ->
print_newline()
done
;;
1, 2, 3, 4, 5
6, 7, 8, 9, 10
- : unit = ()

View file

@ -0,0 +1,10 @@
v = "";
for i = 1:10
v = sprintf("%s%d", v, i);
if ( mod(i, 5) == 0 )
disp(v)
v = "";
continue
endif
v = sprintf("%s, ", v);
endfor

View file

@ -0,0 +1,8 @@
for I in 1..10 continue:C do
{System.print I}
if I mod 5 == 0 then
{System.printInfo "\n"}
{C}
end
{System.printInfo ", "}
end

View file

@ -0,0 +1,5 @@
for(n=1,10,
print1(n);
if(n%5 == 0, print();continue);
print1(", ")
)

View file

@ -0,0 +1,6 @@
loop:
do i = 1 to 10;
put edit (i) (f(3));
if mod(i,5) = 0 then do; put skip; iterate loop; end;
put edit (', ') (a);
end;

View file

@ -0,0 +1,8 @@
for 1 .. 10 {
.print;
if $_ %% 5 {
print "\n";
next;
}
print ', ';
}

View file

@ -0,0 +1 @@
$_.join(", ").say for [1..5], [6..10];

View file

@ -0,0 +1,10 @@
int main(){
for(int i = 1; i <= 10; i++){
write(sprintf("%d",i));
if(i % 5 == 0){
write("\n");
continue;
}
write(", ");
}
}

View file

@ -0,0 +1,9 @@
lvars i;
for i from 1 to 10 do
printf(i, '%p');
if i rem 5 = 0 then
printf('\n');
nextloop;
endif;
printf(', ')
endfor;

View 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 ", "
}

View file

@ -0,0 +1,12 @@
OpenConsole()
For i.i = 1 To 10
Print(Str(i))
If i % 5 = 0
PrintN("")
Continue
EndIf
Print(",")
Next
Repeat: Until Inkey() <> ""

View file

@ -0,0 +1,22 @@
REBOL [
Title: "Loop/Continue"
Author: oofoe
Date: 2010-01-05
URL: http://rosettacode.org/wiki/Loop/Continue
]
; REBOL 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 ", "
]
]

View file

@ -0,0 +1,3 @@
for i = 1 to 10
if i mod 5 <> 0 then print i;", "; else print i
next i

View file

@ -0,0 +1,10 @@
iterate (x; [1...10])
{
print(x);
if (x % 5 == 0)
{
print("\n");
continue;
};
print(", ");
};

View file

@ -0,0 +1,11 @@
ob = Object()
for (i = 1; i <= 10; ++i)
{
ob.Add(i)
if i is 5
{
Print(ob.Join(','))
ob = Object()
}
}
Print(ob.Join(','))

View file

@ -0,0 +1,3 @@
1,2,3,4,5
6,7,8,9,10
ok

View file

@ -0,0 +1,13 @@
count()
Prgm
""→s
For i,1,10
s&string(i)→s
If mod(i,5)=0 Then
Disp s
""→s
Cycle
EndIf
s&", "→s
EndFor
EndPrgm

View file

@ -0,0 +1,9 @@
$$ MODE TUSCRIPT
numbers=""
LOOP n=1,10
numbers=APPEND (numbers,", ",n)
rest=n%5
IF (rest!=0) CYCLE
PRINT numbers
numbers=""
ENDLOOP

View file

@ -0,0 +1,10 @@
Z=1
while (( Z<=10 )); do
echo -e "$Z\c"
if (( Z % 5 != 0 )); then
echo -e ", \c"
else
echo -e ""
fi
(( Z++ ))
done

View file

@ -0,0 +1,8 @@
for ((i=1;i<=10;i++)); do
echo -n $i
if [ $((i%5)) -eq 0 ]; then
echo
continue
fi
echo -n ", "
done

View file

@ -0,0 +1 @@
yes \ | cat -n | head -n 10 | xargs -n 5 echo | tr ' ' ,

View file

@ -0,0 +1,8 @@
for (#1 = 1; #1 <= 10; #1++) {
Num_Type(#1, LEFT+NOCR)
if (#1 % 5 == 0) {
Type_Newline
Continue
}
Message(", ")
}

View file

@ -0,0 +1,8 @@
For i = 1 To 10
Console.Write(i)
If i Mod 5 = 0 Then
Console.WriteLine()
Else
Console.Write(", ")
End If
Next

View file

@ -0,0 +1,4 @@
code CrLf=9, IntOut=11, Text=12;
integer N;
for N:= 1 to 10 do
[IntOut(0, N); if remainder(N/5) \#0\ then Text(0, ", ") else CrLf(0)]