Course of Raku / Essentials / More about types / 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.

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

Course navigation

Nested hashes   |   Interpolating hashes

Translations of this page: EnglishDeutschEspañolItalianoLatviešuNederlandsБългарскиРусскийУкраїнська