Course of Raku / Addendum 🆕 / Flow and functions / Subroutines and functional style / Exercises

Describe by type

Problem

Using multiple dispatch, write a describe subroutine that reacts differently to an integer, a string, and a list. Call it with 42, 'hi', and [1, 2, 3].

Example

The program prints:

integer 42
string hi
list of 3

Solution

See the solution

Course navigation

Solution: Sum of even squares   |   Solution: Describe by type