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,5 @@
foreach (i in [1 .. 10])
{
Write(i);
unless (i == 10) Write(", ");
}

View file

@ -0,0 +1,16 @@
/* NetRexx */
options replace format comments java crossref savelog symbols nobinary
say
say 'Loops/N plus one half'
rs = ''
istart = 1
iend = 10
loop i_ = istart to iend
rs = rs || i_.right(3)
if i_ < iend then do
rs = rs','
end
end i_
say rs

View file

@ -0,0 +1,7 @@
let last = 10 in
for i = 1 to last do
print_int i;
if i <> last then
print_string ", ";
done;
print_newline();

View file

@ -0,0 +1,3 @@
let ints = [1; 2; 3; 4; 5; 6; 7; 8; 9; 10] in
let str_ints = List.map string_of_int ints in
print_endline (String.concat ", " str_ints);

View file

@ -0,0 +1,14 @@
bundle Default {
class Hello {
function : Main(args : String[]) ~ Nil {
for(i := 1; true; i += 1;) {
i->Print();
if(i = 10) {
break;
};
", "->Print();
};
'\n'->Print();
}
}
}

View file

@ -0,0 +1,5 @@
for N in {List.number 1 10 1} break:Break do
{System.printInfo N}
if N == 10 then {Break} end
{System.printInfo ", "}
end

View file

@ -0,0 +1,11 @@
declare
fun {CommaSep Xs}
case Xs of nil then nil
[] X|Xr then
{FoldL Xr
fun {$ Z X} Z#", "#X end
X}
end
end
in
{System.showInfo {CommaSep {List.number 1 10 1}}}

View file

@ -0,0 +1,6 @@
n=0;
while(1,
print1(n++);
if(n>9, break);
print1(", ")
);

View file

@ -0,0 +1,4 @@
do i = 1 to 10;
put edit (trim(i)) (a);
if i < 10 then put edit (', ') (a);
end;

View file

@ -0,0 +1,14 @@
program numlist(output);
var
i: integer;
begin
for i := 1 to 10 do
begin
write(i);
if i <> 10 then
write(', ')
end;
writeln;
end.

View file

@ -0,0 +1,7 @@
for 1 .. 10 {
.print;
last when 10;
print ', ';
}
print "\n";

View file

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

View file

@ -0,0 +1,7 @@
lvars i;
for i from 1 to 10 do
printf(i, '%p');
quitif(i = 10);
printf(', ', '%p');
endfor;
printf('\n', '%p');

View file

@ -0,0 +1,8 @@
for ($i = 1; $i -le 10; $i++) {
Write-Host -NoNewLine $i
if ($i -eq 10) {
Write-Host
break
}
Write-Host -NoNewLine ", "
}

View file

@ -0,0 +1,5 @@
switch (1..10) {
{ $true } { Write-Host -NoNewLine $_ }
{ $_ -lt 10 } { Write-Host -NoNewLine ", " }
{ $_ -eq 10 } { Write-Host }
}

View file

@ -0,0 +1,7 @@
x=1
Repeat
Print(Str(x))
x+1
If x>10: Break: EndIf
Print(", ")
ForEver

View file

@ -0,0 +1,13 @@
REBOL [
Title: "Loop Plus Half"
Date: 2009-12-16
Author: oofoe
URL: http://rosettacode.org/wiki/Loop/n_plus_one_half
]
repeat i 10 [
prin i
if 10 = i [break]
prin ", "
]
print ""

View file

@ -0,0 +1,4 @@
loop str = str lt(i,10) (i = i + 1) :f(out)
str = str ne(i,10) ',' :s(loop)
out output = str
end

View file

@ -0,0 +1,6 @@
output('out',1,'-[-r1]')
loop i = lt(i,10) i + 1 :f(end)
out = i
eq(i,10) :s(end)
out = ',' :(loop)
end

View file

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

View file

@ -0,0 +1,14 @@
$ include "seed7_05.s7i";
const proc: main is func
local
var integer: number is 0;
begin
for number range 1 to 10 do
write(number);
if number < 10 then
write(", ")
end if;
end for;
writeln;
end func;

View file

@ -0,0 +1,9 @@
Local str
"" → str
For i,1,10
str & string(i) → str
If i < 10 Then
str & "," → str
EndIf
EndFor
Disp str

View file

@ -0,0 +1,7 @@
$$ MODE TUSCRIPT
line=""
LOOP n=1,10
line=CONCAT (line,n)
IF (n!=10) line=CONCAT (line,", ")
ENDLOOP
PRINT line

View file

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

View file

@ -0,0 +1,5 @@
for ((i=1;i<=$((last=10));i++)); do
echo -n $i
[ $i -eq $last ] && break
echo -n ", "
done

View file

@ -0,0 +1 @@
yes \ | cat -n | head -n 10 | paste -d\ - <(yes , | head -n 9) | xargs echo

View file

@ -0,0 +1,4 @@
[loop
[ [10 =] [puts]
[true] [dup put ',' put succ loop]
] when].

View file

@ -0,0 +1,6 @@
for (#1 = 1; 1; #1++) {
Num_Ins(#1, LEFT+NOCR)
if (#1 == 10) { Break }
Ins_Text(", ")
}
Ins_Newline

View file

@ -0,0 +1,5 @@
For i = 1 To 10
Console.Write(i)
If i = 10 Then Exit For
Console.Write(", ")
Next

View file

@ -0,0 +1,14 @@
codes CrLf=9, IntOut=11, Text=12;
int N;
[for N:= 1 to 10 do \best way to do this
[IntOut(0, N); if N#10 then Text(0, ", ")];
CrLf(0);
N:= 1; \way suggested by task statement
loop [IntOut(0, N);
if N=10 then quit;
Text(0, ", ");
N:= N+1;
];
CrLf(0);
]