Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,57 @@
|
|||
Module checkit {
|
||||
\\ Inventories are objects with keys and values, or keys (used as read only values)
|
||||
\\ They use hash function.
|
||||
\\ Function TwoKeys return Inventory object (as a pointer to object)
|
||||
Function TwoKeys {
|
||||
Inventory Alfa="key1":=100, "key2":=200
|
||||
=Alfa
|
||||
}
|
||||
M=TwoKeys()
|
||||
Print Type$(M)="Inventory"
|
||||
\\ Normal Use:
|
||||
\\ Inventories Keys are case sensitive
|
||||
\\ M2000 identifiers are not case sensitive
|
||||
Print M("key1"), m("key2")
|
||||
\\ numeric values can convert to strings
|
||||
Print M$("key1"), m$("key2")
|
||||
\\ Iteration
|
||||
N=Each(M)
|
||||
While N {
|
||||
Print Eval(N) ' prints 100, 200 as number
|
||||
Print M(N^!) ' The same using index N^
|
||||
}
|
||||
N=Each(M)
|
||||
While N {
|
||||
Print Eval$(N) ' prints 100, 200 as strings
|
||||
Print M$(N^!) ' The same using index N^
|
||||
}
|
||||
N=Each(M)
|
||||
While N {
|
||||
Print Eval$(N, N^) ' Prints Keys
|
||||
}
|
||||
\\ double iteration
|
||||
Append M, "key3":=500
|
||||
N=Each(M, 1, -1) ' start to end
|
||||
N1=Each(M, -1, 1) ' end to start
|
||||
\\ 3x3 prints
|
||||
While N {
|
||||
While N1 {
|
||||
Print format$("{0}*{1}={2}", Eval(N1), Eval(N), Eval(N1)*Eval(N))
|
||||
}
|
||||
}
|
||||
\\ sort results from lower product to greater product (3+2+1, 6 prints only)
|
||||
N=Each(M, 1, -1)
|
||||
While N {
|
||||
N1=Each(M, N^+1, -1)
|
||||
While N1 {
|
||||
Print format$("{0}*{1}={2}", Eval(N1), Eval(N), Eval(N1)*Eval(N))
|
||||
}
|
||||
}
|
||||
N=Each(M)
|
||||
N1=Each(M,-2, 1) ' from second from end to start
|
||||
\\ print only 2 values. While block ends when one iterator finish
|
||||
While N, N1 {
|
||||
Print Eval(N1)*Eval(N)
|
||||
}
|
||||
}
|
||||
Checkit
|
||||
Loading…
Add table
Add a link
Reference in a new issue