Course of Raku / Essentials / Positional data types / Quoting string arrays

Quiz 2 — Recognising lists

Lists may be confusing sometimes. You have to train yourself to distinguish between lists and arrays.

1

What does the following program print?

my @data = [
    <France Italy Germany>,
    <Canada USA Mexica>,
    <Japan China India>,
];

say @data[0].WHAT;
(List) Answer: (: (Array), (List), (Str) :)

2

And what about this program?

my @data = [
    ['France', 'Italy', 'Germany'],
    ['Canada', 'USA', 'Mexica'],
    ['Japan', 'China', 'India'],
];

say @data[0].WHAT;
(Array) Answer: (: (Array), (List), (Str) :)

Course navigation

Positional data types / Lists   |   Positional data types / Subscripting ranges


💪 Or jump directly to the exercises to this section.

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