Raku-Kurs / Grundlagen / Mehr über Typen / Positionale Datentypen / Interpolation von Arrays

Quiz — Interpolation von Arrays

Given the following array:

my @arr = 10, 9, 8, 3, 2, 1;

Complete the below programs to get the requested output.

1

Print the third element (the item with index 2).

[2]say "Das dritte Element ist @arr␣␣";

2

Print all elements (without indexing all of them explicitly).

arr[]say "Dieses Array enthält: @␣␣␣␣.";Die Ausgabe ist „Dieses Array enthält: 10 9 8 3 2 1.“

3

Print the size of the array (by calling the elems method).

{@arr.elems}say "Es gibt ␣␣␣␣␣␣␣␣ Elemente.";Geschweifte Klammern erforderlich, um Raku-Code in einen Raku-String einzubetten.

Kursnavigation

Interpolation von Arrays   |   Listen