RosettaCodeData/Task/Scope-Function-names-and-labels/M2000-Interpreter/scope-function-names-and-labels.m2000
2023-07-01 13:44:08 -04:00

59 lines
955 B
Text

Function Master {
Module Alfa {
Gosub 100
Global M=1000
\\ delta print 1000
delta
End
100 Print Module(Beta)=False
Print Module(Delta)=True
Return
}
Group Object1 {
Function Master {
=M
}
Module Final Beta {
\\ delta print 500
delta
alfa()
Sub alfa()
Local N=@Kappa(3)
Global M=N
\\ delta print 1500
Delta
Print This.Master()=1500
N=@Kappa(6)
\\ change value of M, not shadow M like Global M
M<=N
\\ delta print 9000
Delta
Print .Master()=9000
End Sub
Function Kappa(K)
=M*K
End Function
}
}
Module Global Delta {
Goto name1
\\ a remark here
name1:
Print Module(Alfa)=False
Print Module(Beta)=False
Print Module(Delta)=True
Print M
}
\\ This is the program
K=100
Global M=500
Alfa
Object1.Beta
Print Object1.Master()=500
Print K=100, M=500
}
Call Master()
\\ No variables exist after the return from Master()
Print Valid(M)=False