Course of Raku / Advanced / More about built-in types / Enumerations 🆕 / Defining an enum
Quiz — Enumerations
What does the following program print?
enum Colour <red green blue>;
say green + blue;| 1 | 3 |
| 0 | greenblue |
| 0 | (green blue) |
| 0 | an error |
Each constant stands for a number, assigned from zero in the order
listed: red is 0, green is
1, blue is 2. In an arithmetic
context the constants act as those numbers, so green + blue
is 1 + 2, which is 3.