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,8 @@
for (int i = 0; i < 5; i++)
{
for (int j = 0; j <= i; j++)
{
Write("*");
}
WriteLine();
}

View file

@ -0,0 +1,12 @@
/* NetRexx */
options replace format comments java crossref savelog symbols nobinary
say
say 'Loops/For'
loop i_ = 1 to 5
loop for i_
say '*\-'
end
say
end i_

View file

@ -0,0 +1,4 @@
(for (i 1 5)
(for(j 1 i)
(print "*"))
(print "\n"))

View file

@ -0,0 +1,4 @@
for i in 1..5:
for i in 1..i:
stdout.write("*")
echo("")

View file

@ -0,0 +1,6 @@
for i = 1 to 5 do
for j = 1 to i do
print_string "*"
done;
print_newline ()
done

View file

@ -0,0 +1,16 @@
bundle Default {
class For {
function : Main(args : String[]) ~ Nil {
DoFor();
}
function : native : DoFor() ~ Nil {
for (i := 0; i < 5; i += 1;) {
for (j := 0; j <= i; j += 1;) {
"*"->Print();
};
""->PrintLine();
};
}
}
}

View file

@ -0,0 +1,6 @@
for i = 0:1:4
for j = 0:1:i
printf("*");
endfor
printf("\n");
endfor

View file

@ -0,0 +1,10 @@
#include <order/interpreter.h>
ORDER_PP(
8for_each_in_range(8fn(8I,
8print(
8for_each_in_range(8fn(8J, 8print((*))),
1, 8plus(8I, 1))
8space)),
1, 6)
)

View file

@ -0,0 +1,6 @@
for I in 1..5 do
for _ in 1..I do
{System.printInfo "*"}
end
{System.showInfo ""}
end

View file

@ -0,0 +1 @@
for(a=1,5,for(b=1,a,print1("*"));print())

View file

@ -0,0 +1,3 @@
do i = 1 to 5;
put skip edit (('*' do j = 1 to i)) (a);
end;

View file

@ -0,0 +1,13 @@
program stars(output);
var
i, j: integer;
begin
for i := 1 to 5 do
begin
for j := 1 to i do
write('*');
writeln
end
end.

View file

@ -0,0 +1,9 @@
for ^5 {
for 0..$_ {
print "*";
}
print "\n";
}

View file

@ -0,0 +1 @@
say '*' x $_ for 1..5;

View file

@ -0,0 +1 @@
([\~] "*" xx 5).join("\n").say;

View file

@ -0,0 +1,8 @@
int main(){
for(int i = 1; i <= 5; i++){
for(int j=1; j <= i; j++){
write("*");
}
write("\n");
}
}

View file

@ -0,0 +1,7 @@
lvars i, j;
for i from 1 to 5 do
for j from 1 to i do
printf('*','%p');
endfor;
printf('\n')
endfor;

View file

@ -0,0 +1,6 @@
for ($i = 1; $i -le 5; $i++) {
for ($j = 1; $j -le $i; $j++) {
Write-Host -NoNewline *
}
Write-Host
}

View file

@ -0,0 +1,6 @@
1..5 | ForEach-Object {
1..$_ | ForEach-Object {
Write-Host -NoNewline *
}
Write-Host
}

View file

@ -0,0 +1,11 @@
If OpenConsole()
Define i, j
For i=1 To 5
For j=1 To i
Print("*")
Next j
PrintN("")
Next i
Print(#LFCR$+"Press ENTER to quit"): Input()
CloseConsole()
EndIf

View file

@ -0,0 +1,13 @@
; Use 'repeat' when an index required, 'loop' when repetition suffices:
repeat i 5 [
loop i [prin "*"]
print ""
]
; or a more traditional for loop:
for i 1 5 1 [
loop i [prin "*"]
print ""
]

View file

@ -0,0 +1 @@
6 [ 0; cr [ '* emit ] times ] iter

View file

@ -0,0 +1,10 @@
data _null_;
length a $5;
do n=1 to 5;
a="*";
do i=2 to n;
a=trim(a) !! "*";
end;
put a;
end;
run;

View file

@ -0,0 +1,6 @@
ol outer = ?lt(outer,5) outer + 1 :f(end)
inner = outer; stars = ""
il stars = ?gt(inner,0) stars "*" :f(disp)
inner = inner - 1 :(il)
disp output = stars; :(ol)
end

View file

@ -0,0 +1,4 @@
outer b = a = ?lt(a,5) a + 1 :f(end)
inner t = t ?(b = (gt(b,0) b - 1)) "*" :s(inner)
t span("*") . terminal = :(outer)
end

View file

@ -0,0 +1,3 @@
a = "*****";
a a len(x = x + 1) . output :s(a)
end

View file

@ -0,0 +1,2 @@
"*****" arb $ output fail
end

View file

@ -0,0 +1,6 @@
iterate (x; [0...4])
{
iterate (y; [0...x])
print("*");;
print("\n");
};

View file

@ -0,0 +1,6 @@
for (x; 0; x < 5)
{
for (y; 0; y <= x)
print("*");;
print("\n");
};

View file

@ -0,0 +1,6 @@
for I range 1 to 5 do
for J range 1 to I do
write("*");
end for;
writeln;
end for;

View file

@ -0,0 +1 @@
1 to: 5 do: [| :n | inform: ($* repeatedTimes: n)].

View file

@ -0,0 +1,7 @@
for(i = 0; i < 5; ++i)
{
str = ''
for (j = 0; j <= i; ++j)
str $= '*'
Print(str)
}

View file

@ -0,0 +1,7 @@
Local i,j
ClrIO
For i, 1, 5
For j, 1, i
Output i*8, j*6, "*"
EndFor
EndFor

View file

@ -0,0 +1,6 @@
$$ MODE TUSCRIPT
m=""
LOOP n=1,5
m=APPEND (m,"","*")
PRINT m
ENDLOOP

View file

@ -0,0 +1,8 @@
for(%i = 0; %i < 5; %i++)
{
for(%x = %i; %x < 5; %x++)
{
%string = %string @ "*";
echo(%string);
}
}

View file

@ -0,0 +1,15 @@
#!/bin/sh
# Using a while control construct to emulate a for loop
l="1" # Set the counters to one
while [ "$l" -le 5 ] # Loop while the counter is less than five
do
m="1"
while [ "$m" -le "$l" ] # Loop while the counter is less than five
do
printf "*"
m=`expr "$m" + 1` # Increment the inner counter
done
echo
l=`expr "$l" + 1` # Increment the outer counter
done

View file

@ -0,0 +1,6 @@
for i in `jot 5`; do
for j in `jot $i`; do
printf \*
done
echo
done

View file

@ -0,0 +1,6 @@
for (( x=1; $x<=5; x=$x+1 )); do
for (( y=1; y<=$x; y=$y+1 )); do
echo -n '*'
done
echo ""
done

View file

@ -0,0 +1,6 @@
foreach i (`jot 5`)
foreach j (`jot $i`)
echo -n \*
end
echo ""
end

View file

@ -0,0 +1,4 @@
yes \ | cat -n | (while read n ; do
[ $n -gt 5 ] && exit 0;
yes \* | head -n $n | xargs -n $n echo
done)

View file

@ -0,0 +1,6 @@
for (#1 = 1; #1 <= 5; #1++) {
for (#2 = 1; #2 <= #1; #2++) {
Type_Char('*')
}
Type_Newline
}

View file

@ -0,0 +1,6 @@
For x As Integer = 0 To 4
For y As Integer = 0 To x
Console.Write("*")
Next
Console.WriteLine()
Next

View file

@ -0,0 +1,15 @@
'This Prints to the Debug-Window!
Dim i As Integer
Dim ii As Integer
Dim x As Integer
Dim out As String
output = ""
For i = 1 To 5
For ii = 1 To i
out = out + "*"
Next ii
Debug.Print (out)
out = ""
Next i

View file

@ -0,0 +1,7 @@
code ChOut=8, CrLf=9;
int I, J;
for I:= 1 to 5 do
[for J:= 1 to I do
ChOut(0, ^*);
CrLf(0);
]