Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,24 @@
|
|||
Class Something {
|
||||
\\ this class is a global function
|
||||
\\ return a group with a value with one parameter
|
||||
private:
|
||||
\\ we can use lambda(), but here we use .fib1() as This.fib1()
|
||||
fib1=lambda (x)->If(x>1->.fib1(x-1)+.fib1(x-2), x)
|
||||
public:
|
||||
Value (x) {
|
||||
If x<0 then Error "argument outside of range"
|
||||
If x<2 then =x : exit
|
||||
=This.fib1(x) \\ we can omit This using .fib1(x)
|
||||
}
|
||||
}
|
||||
K=Something() ' K is a static group here
|
||||
Print k(12)=144
|
||||
Dim a(10)
|
||||
a(4)=Group(K)
|
||||
Print a(4)(12)=144
|
||||
pk->Something() ' pk is a pointer to group (object in M2000)
|
||||
\\ pointers need Eval to process arguments
|
||||
Print Eval(pk, 12)=144
|
||||
Inventory Alfa = "Key2":=Group(k), 10*10:=pk
|
||||
Print Alfa("Key2")(12)=144
|
||||
Print Eval(Alfa("100"),12)=144, Eval(Alfa(100),12)=144
|
||||
Loading…
Add table
Add a link
Reference in a new issue