Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,77 @@
|
|||
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
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
Module CheckIt {
|
||||
Module CheckSub {
|
||||
Read Z
|
||||
M=5000
|
||||
Module CheckThis {
|
||||
Z=500
|
||||
Hello("Bob")
|
||||
}
|
||||
Function CheckFun {
|
||||
Z=50
|
||||
Hello("Mary")
|
||||
}
|
||||
Call CheckFun()
|
||||
CheckThis
|
||||
Hello("George")
|
||||
Gosub label1
|
||||
\\ sub work as exit here
|
||||
Sub Hello(a$)
|
||||
\\ any new definition erased at exit of sub
|
||||
Local M=100
|
||||
Print "Hello ";a$, Z, M
|
||||
End Sub
|
||||
label1:
|
||||
\\ this light subs have no "erased new definition mode"
|
||||
\\ they are like code of module
|
||||
Print Z, M
|
||||
Return
|
||||
}
|
||||
CheckSub 10
|
||||
Module CheckOther {
|
||||
Z=1000
|
||||
Hello("John")
|
||||
}
|
||||
\\ we can replace CheckThis with CheckOther
|
||||
CheckSub 20; CheckThis as CheckOther
|
||||
}
|
||||
Call Checkit
|
||||
Module Alfa {
|
||||
x=1
|
||||
Thread {
|
||||
x++
|
||||
} as K interval 20
|
||||
Thread {
|
||||
PrintMe()
|
||||
} as J interval 20
|
||||
Main.Task 20 {
|
||||
if x>99 then exit
|
||||
}
|
||||
Wait 100
|
||||
Sub PrintMe()
|
||||
Print x
|
||||
End Sub
|
||||
}
|
||||
Call Alfa
|
||||
Loading…
Add table
Add a link
Reference in a new issue