Course of Raku / Essentials / More about types / Positional data types / Lists

Quiz — List and scalar vs. list and array

There are lists on the right-hand side in the below assignments. Objects of which type do the variables keep?

1

my $x = (100, 200, 300);
my @x = (100, 200, 300);

say $x.WHAT;
say @x.WHAT;

Choose the correct answers:

(List)The type of $x is  (: (Array), (Int), (List) :)
(Array)The type of @x is  (: (Array), (Int), (List) :)

2*

Here is a more complicated case. Do not worry if you do not understand it now. We will return to this topic in the second part of the course.

my $x = [100, 200, 300];
my @x = [100, 200, 300];

say $x.WHAT;
say @x.WHAT;

Choose the correct answers:

(Array)The type of $x is  (: (Array), (Int), (List) :)
(Array)The type of @x is  (: (Array), (Int), (List) :)

Course navigation

Lists   |   Quoting string arrays

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