40 lines
724 B
Text
40 lines
724 B
Text
enum constA {
|
|
x=10
|
|
y=30
|
|
}
|
|
// constB get two members of constA to same list, but x and y are defined once as ConstB
|
|
enum constB {
|
|
constA, z="ok"
|
|
}
|
|
// m is a ConstB type. X value exist in ConstB
|
|
def m as ConstB=x
|
|
|
|
module inner (z as constB) {
|
|
print z=10
|
|
try {
|
|
z=500
|
|
}
|
|
print z=10, eval$(z)="x"
|
|
check(z)
|
|
z++
|
|
print z=30, eval$(z)="y"
|
|
check(z)
|
|
z++
|
|
print z="ok", eval$(z)="z"
|
|
check(z)
|
|
try {
|
|
z=30 // ok 30 exist in enum constB list
|
|
}
|
|
check(z) // z is y now
|
|
sub check(z as constB)
|
|
select enum z // like a select case but for enumeration type to check names
|
|
case x ' check name of enum
|
|
print "it is x", z
|
|
case y
|
|
print "it is y", z
|
|
case z
|
|
print "it is z", z
|
|
end select
|
|
end sub
|
|
}
|
|
inner m
|