Course of Raku / Advanced /
Control flow / given and when
/ Exercises
Even, odd, or zero
Problem
Using given/when, print whether a
hard-coded integer is zero, even, or
odd. Note that zero is technically even, so check for it
first and report it separately.
Example
For the number 12, the program prints:
evenSolution
Course navigation
← Solution: Life stage from age | Solution: Even, odd, or zero →