Course of Raku / Advanced / More about built-in types / Enumerations 🆕 / Exercises
Weekday numbers
Problem
An enum maps names to numbers, but you can also go the other way: calling the enum type like a function, with a number, returns the matching constant.
Define an enum Day whose constants Mon to
Fri are numbered from 1 to 5.
Then look up and print the constants for the numbers 5 and
1.
Example
The program prints:
Fri
Mon