Course of Raku / Advanced /
Control flow / given and when
/ Exercises
Life stage from age
Problem
Using given/when, print the life stage for
a hard-coded age according to these bands:
childfor 0–12,teenagerfor 13–19,adultfor 20–64,seniorfor 65 and above.
A negative age makes no sense, so print invalid for any
number below zero. Make sure that case is handled before the range
checks.
Example
For the age 30, the program prints:
adult