Course of Raku / Essentials / Associative data types / Nested hashes

Quiz — Multilevel hashes

For the given data structure:

my %statistics =
    1900 => {
        Jan => 500,
        Feb => 550,
    },
    2000 => {
        Jan => 1230,
        Feb => 1245,
    };

Select the lines which provide correct access to the data item for February of 1900.

1 say %statistics<1900><Feb>;  
1 say %statistics{1900}<Feb>; This is correct, as 1900 can be implicitly cast to a string.
0 say %statistics{1900}{Feb}; Incorrect, as Feb must be a string.
1 say %statistics{'1900'}{'Feb'};  

Course navigation

Associative data types / Hashes   |   Associative data types / Interpolating hashes


💪 Or jump directly to the exercises to this section.