28 lines
515 B
Plaintext
28 lines
515 B
Plaintext
// Without explicit values
|
|
enumeration FruitsKind
|
|
APPLE,
|
|
BANANA,
|
|
CHERRY
|
|
end
|
|
|
|
program EnumerationTest
|
|
|
|
function main()
|
|
whatFruitAmI(FruitsKind.CHERRY);
|
|
end
|
|
|
|
function whatFruitAmI(fruit FruitsKind)
|
|
case (fruit)
|
|
when(FruitsKind.APPLE)
|
|
syslib.writestdout("You're an apple.");
|
|
when(FruitsKind.BANANA)
|
|
syslib.writestdout("You're a banana.");
|
|
when(FruitsKind.CHERRY)
|
|
syslib.writestdout("You're a cherry.");
|
|
otherwise
|
|
syslib.writestdout("I'm not sure what you are.");
|
|
end
|
|
end
|
|
|
|
end
|