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,11 @@
10 DIM A$(9) :REM DECLARE STRING ARRAY
20 REM *** FILL ARRAY WITH WORDS ***
30 FOR I = 0 TO 8
40 READ A$(I)
50 NEXT
60 REM *** PRINT ARRAY CONTENTS ***
70 FOR I = 0 TO 8
80 PRINT A$(I)" ";
90 NEXT
100 END
1000 DATA THE, QUICK, BROWN, FOX, JUMPS, OVER, THE, LAZY, DOG.

View file

@ -0,0 +1,19 @@
DEF AnArray[11]:INT
AnArray=0,1,2,3,4,5,6,7,8,9,10
'A console only program will work without OPENCONSOLE and
'CLOSECONSOLE; however, it does not hurt to use them.
OPENCONSOLE
FOR X=0 TO 10
PRINT AnArray[X]
NEXT X
'keep the console from closing right away.
DO:UNTIL INKEY$<>""
CLOSECONSOLE
'because this is a console only program.
END

View file

@ -0,0 +1,32 @@
DEF AList:POINTER
AList=ListCreate()
'Add items to the list.
DEF X:INT
FOR X=0 TO 10
POINTER Temp=ListAdd(AList,NEW(INT,1))
#<INT>temp=X
'The hash ("#") dereferencing operator is unique to IWBASIC and Creative Basic, and
'it is suitable for most basic pointer needs. IWBASIC also supports a "C style"
'dereferencing operator: "*". And that will work here too.
NEXT X
'A program compiled as console only does not need the commands to open and
'close the console. However, it does not hurt to use them.
OPENCONSOLE
'***Iterate the list with the "for each" loop***
FOR Temp=EACH AList AS INT
PRINT #Temp
NEXT
PRINT
'A press any key to continue message is automatic in a program compiled as a console only
program. I presume the compiler inserts the code.
CLOSECONSOLE
'Because this is a console only program.
END

View file

@ -0,0 +1,17 @@
DEF AnArray[11]:INT
AnArray=0,1,2,3,4,5,6,7,8,9,10
OPENCONSOLE
FOR X=0 TO 10
PRINT AnArray[X]
NEXT X
PRINT
'a press any key message is automatic when compiled as console only.
CLOSECONSOLE
'Because this is a console only program.
END

View file

@ -0,0 +1,6 @@
a[0] = .123
a[1] = 234
a[3] = 95.6
for (i = 0; i < 4; i++) {
a[i]
}

View file

@ -1,3 +0,0 @@
open console imperative
each writen [1..10]

View file

@ -1,2 +0,0 @@
each f (x::xs) = f x $ each f xs
each _ [] = ()

View file

@ -1,3 +0,0 @@
open console list
_ = map writen [1..10]

View file

@ -1,4 +0,0 @@
each (x::xs) = writen x $ each xs
each [] = ()
each [1..10]

View file

@ -1,10 +1,12 @@
#import system.
#import system'routines.
#import extensions'routines.
import system'routines.
import extensions.
#symbol program =
program =
[
#var things := ("Apple", "Banana", "Coconut").
var things := ("Apple", "Banana", "Coconut").
things run &each:printingLn.
things forEach(:thing)
[
console printLine:thing.
]
].

View file

@ -0,0 +1,3 @@
for path in $PATH
echo You have $path in PATH.
end

View file

@ -0,0 +1,9 @@
Public Sub Main()
Dim siInput As Short[] = [1, 8, 0, 6, 4, 7, 3, 2, 5, 9]
Dim siTemp As Short
For Each siTemp In siInput.Sort()
Print siTemp;;
Next
End

View file

@ -0,0 +1,5 @@
$things = ["Apple", "Banana", "Coconut"];
foreach ($things as $thing) {
echo $thing;
}

View file

@ -0,0 +1 @@
(for [x collection] (print x))

View file

@ -0,0 +1,10 @@
// version 1.0.6
fun main(args: Array<String>) {
val greek = arrayOf("alpha", "beta", "gamma", "delta")
for (letter in greek) print("$letter ")
println()
// or alternatively
greek.forEach { print("$it ") }
println()
}

View file

@ -1,6 +0,0 @@
var list: seq[string] = @[]
list.add("lorem")
list.add("ipsum")
list.add("dolor")
for i in items(list):
echo(i)

View file

@ -0,0 +1,13 @@
/* Rexx */
say
say 'Loops/Foreach'
out = ''
days = .array~of('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday')
loop daysi over days
out ||= daysi' '
end daysi
say out~strip()
exit

View file

@ -0,0 +1,4 @@
local a 2 9 4 7 5 3 6 1 8
foreach i in `a' {
display "`i'"
}

View file

@ -1,8 +1,5 @@
dim items(2)
items(0)="Apple"
items(1)="Orange"
items(2)="Banana"
items = Array("Apple", "Orange", "Banana")
For Each x in items
WScript.Echo x
For Each x In items
WScript.Echo x
Next

View file

@ -0,0 +1,2 @@
foreach c in (T("Red","Green","Blue","Black","White"))
{ print(c," "); }

View file

@ -0,0 +1,2 @@
foreach x,y,z in (T(T(1,2,3), T(4,5,6))) { println(x,y,z) }
foreach x,y,z in (T(1,2,3), T(4,5), T(6)){ println(x,y,z) }