Course of Raku / Advanced / Subroutines / The Whatever star 🆕
Quiz — The Whatever star
What does the following program print?
my @a = 5, 6, 7, 8, 9;
say @a[*-2];| 1 | 8 |
| 0 | 7 |
| 0 | 9 |
| 0 | 3 |
In a subscript, the bare * stands for the number of
elements — here 5. So *-2 is index
3, and the element at index 3 (counting from
zero) is 8.