Course of Raku / Essentials / Positional data types / Lists

Quiz — List and scalar vs. list and array

There ara 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

Positional data types / Interpolating arrays   |   Positional data types / Quoting string arrays


💪 Or jump directly to the exercises to this section.