Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
27
Task/Loops-Foreach/M2000-Interpreter/loops-foreach.m2000
Normal file
27
Task/Loops-Foreach/M2000-Interpreter/loops-foreach.m2000
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
Module Checkit {
|
||||
\\ Inventories may have keys or keys/values
|
||||
\\ here keys are values too
|
||||
Inventory Alfa="Apple", "Banana", "Coconut"
|
||||
\\ key 30 has value 25, other keys have value same as key.
|
||||
Inventory Beta=100, 30:=25, 20, 5
|
||||
Print "Parallel"
|
||||
k=Each(Alfa)
|
||||
k1=Each(Alfa End to Start)
|
||||
k2=Each(Beta)
|
||||
\\ Parallel iterators
|
||||
\\ when one of them end then while end too.
|
||||
\\ so 5 not printed. Print 100, 25, 20
|
||||
While k,k2, k1 {
|
||||
Print Eval$(k), Eval$(k1), Eval(k2)
|
||||
}
|
||||
Print "Nested"
|
||||
\\ Nested iterators
|
||||
k=Each(Alfa)
|
||||
While k {
|
||||
k1=Each(Alfa End to Start)
|
||||
While k1 {
|
||||
Print Eval$(k), Eval$(k1)
|
||||
}
|
||||
}
|
||||
}
|
||||
Checkit
|
||||
Loading…
Add table
Add a link
Reference in a new issue