September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -0,0 +1,18 @@
begin
integer i;
integer procedure getNumber ;
begin
integer n;
write( "n> " );
read( i );
if i< 0 then goto negativeNumber;
i
end getNumber ;
i := getNumber;
write( "positive or zero" );
go to endProgram;
negativeNumber:
writeon( "negative" );
endProgram:
end.

View file

@ -0,0 +1,11 @@
Public Sub Main()
Dim siCount As Short
LOOPIT:
Print siCount;;
Inc siCount
If siCount > 100 Then Quit
Goto LoopIt
End

View file

@ -0,0 +1,2 @@
# Emit at most one item from the stream generated by g:
def first(g): label $out | g | ., break $out;

View file

@ -0,0 +1,14 @@
// version 1.0.6
fun main(args: Array<String>) {
for (i in 0 .. 2) {
for (j in 0 .. 2) {
if (i + j == 2) continue
if (i + j == 3) break
println(i + j)
}
}
println()
if (args.isNotEmpty()) throw IllegalArgumentException("No command line arguments should be supplied")
println("Goodbye!") // won't be executed
}

View file

@ -0,0 +1,9 @@
function func1 ()
return func2()
end
function func2 ()
return func1()
end
func1()

View file

@ -0,0 +1,16 @@
mata
function pythagorean_triple(n) {
for (a=1; a<=n; a++) {
for (b=a; b<=n-a; b++) {
c=n-a-b
if (c>b & c*c==a*a+b*b) {
printf("%f %f %f\n",a,b,c)
goto END
}
}
}
END:
}
pythagorean_triple(1980)
165 900 915

View file

@ -0,0 +1,4 @@
continue; continue(n); // continue nth nested loop
break; break(n); // break out of nth nested loop
try{ ... }catch(exception){ ... } [else{ ... }]
onExit(fcn); // run fcn when enclosing function exits

View file

@ -0,0 +1,3 @@
urlText.pump(String,
fcn(c){ if(c=="%")return(Void.Read,2); return(Void.Skip,c) },
fcn(_,b,c){(b+c).toInt(16).toChar()})

View file

@ -0,0 +1,2 @@
urlText:="http%3A%2F%2Ffoo.com%2Fbar";
urlText.pump(...).println();