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

Quiz 1 — Quoting string arrays   |   Subscripting ranges

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