85 lines
2.0 KiB
Plaintext
85 lines
2.0 KiB
Plaintext
Module Checkit {
|
|
Enum Fruit {
|
|
apple, banana, cherry
|
|
}
|
|
Enum Fruit2 {
|
|
apple2=10,
|
|
banana2=20.5,
|
|
cherry2=30
|
|
}
|
|
Enum StrType {
|
|
alfa="Άλφα",
|
|
beta="Βήτα",
|
|
gamma="Γάμμα",
|
|
delta="Δέλτα"
|
|
}
|
|
Print alfa, beta
|
|
z=alfa
|
|
z++
|
|
Print z=beta, eval$(z)="beta", z="Βήτα"
|
|
z="Γάμμα" ' change to 3rd by searching value from the list
|
|
CheckByReference2(&z)
|
|
z1=Each(StrType, -1, 1) ' from last to first
|
|
while z1
|
|
CheckByValue2(z1)
|
|
end while
|
|
|
|
Print apple, banana, cherry
|
|
Print apple2, banana2, cherry2
|
|
Print Len(apple)=0
|
|
Print Len(banana)=1
|
|
Print Len(cherry)=2
|
|
Print Len(cherry2)=2, Cherry2=30, Type$(Cherry2)="Fruit2"
|
|
|
|
k=each(Fruit)
|
|
While k {
|
|
\\ name of variable, value, length from first (0, 1, 2)
|
|
Print Eval$(k), Eval(k), k^
|
|
}
|
|
m=apple
|
|
Print Eval$(m)="apple"
|
|
Print Eval(m)=m
|
|
m++
|
|
Print Eval$(m)="banana"
|
|
Try {
|
|
\\ error, m is an object
|
|
m=100
|
|
}
|
|
Try {
|
|
\\ error not the same type
|
|
m=apple2
|
|
}
|
|
Try {
|
|
\\ read only can't change
|
|
apple2++
|
|
}
|
|
m++
|
|
Print Eval$(m)="cherry", m
|
|
k=Each(Fruit2 end to start)
|
|
While k {
|
|
Print Eval$(k), Eval(k) , k^
|
|
CheckByValue(Eval(k))
|
|
}
|
|
m2=apple2
|
|
Print "-------------------------"
|
|
CheckByValue(m2)
|
|
CheckByReference(&m2)
|
|
Print m2
|
|
|
|
Sub CheckByValue(z as Fruit2)
|
|
Print Eval$(z), z
|
|
End Sub
|
|
Sub CheckByValue2(z as StrType)
|
|
Print Eval$(z), z
|
|
End Sub
|
|
Sub CheckByReference(&z as Fruit2)
|
|
z++
|
|
Print Eval$(z), z
|
|
End Sub
|
|
Sub CheckByReference2(&z as StrType)
|
|
z++
|
|
Print Eval$(z), z
|
|
End Sub
|
|
}
|
|
Checkit
|