78 lines
2.2 KiB
Plaintext
78 lines
2.2 KiB
Plaintext
Module Checkit {
|
|
M=1000
|
|
Function Global xz {
|
|
=9999
|
|
}
|
|
Module TopModule {
|
|
\\ clear vars and static vars
|
|
Clear
|
|
M=500
|
|
Function Global xz {
|
|
=10000
|
|
}
|
|
Module Kappa {
|
|
Static N=1
|
|
Global M=1234
|
|
x=1
|
|
z=1
|
|
k=1
|
|
Group Alfa {
|
|
Private:
|
|
x=10, z=20, m=100
|
|
Function xz {
|
|
=.x*.z+M
|
|
}
|
|
Public:
|
|
k=50
|
|
Module AddOne {
|
|
.x++
|
|
.z++
|
|
.k++
|
|
Print .xz(), .m=100
|
|
}
|
|
Module ResetValues {
|
|
\\ use <= to change members, else using = we define local variables
|
|
.x<=10
|
|
.z<=20
|
|
}
|
|
}
|
|
' print 1465
|
|
Alfa.AddOne
|
|
Print x=1, z=1, k=1, xz()=10000
|
|
Print N ' 1 first time, 2 second time
|
|
N++
|
|
Push Alfa
|
|
}
|
|
Kappa
|
|
Drop ' drop one alfa
|
|
Kappa
|
|
Print M=500
|
|
' leave one alfa in stack of values
|
|
}
|
|
TopModule
|
|
Read AlfaNew
|
|
Try ok {
|
|
AlfaNew.AddOne
|
|
}
|
|
\\ we get an error because M global not exist now
|
|
\\ here M is Local.
|
|
If Error or Not Ok Then Print Error$ ' Uknown M in .xz() in AlfaNew.AddOne
|
|
Print M=1000, xz()=9999
|
|
For AlfaNew {
|
|
Global M=1234
|
|
.ResetValues
|
|
.AddOne ' now works because M exist as global, for this block
|
|
}
|
|
Print M=1000, xz()=9999
|
|
For This {
|
|
Local M=50
|
|
M++
|
|
Print M=51
|
|
}
|
|
Print M=1000
|
|
}
|
|
Checkit
|
|
List ' list of variables are empty
|
|
Modules ? ' list of modules show two: A and A.Checkit
|
|
Print Module$ ' print A
|