23 lines
487 B
Plaintext
23 lines
487 B
Plaintext
in Org:RosettaCode
|
|
type Fruits
|
|
enum
|
|
int APPLE, BANANA, CHERRY
|
|
end
|
|
type ExplicitFruits
|
|
enum
|
|
int APPLE ← 10
|
|
int BANANA ← 20
|
|
int CHERRY ← 1
|
|
end
|
|
type Main
|
|
for each generic enumeration in generic[Fruits, ExplicitFruits]
|
|
writeLine("[", Generic.name(enumeration), "]")
|
|
writeLine("getting an object with value = 1:")
|
|
writeLine(:enumeration.byValue(1))
|
|
writeLine("iterating over the items:")
|
|
for each var fruit in :enumeration
|
|
writeLine(fruit)
|
|
end
|
|
writeLine()
|
|
end
|