Skip to content

Commit 8858b54

Browse files
documented tail method for last elements too
1 parent fde45f2 commit 8858b54

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

doc/Language/traps.pod6

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ last element of an array becomes:
172172
173173
my @array = qw{victor alice bob charlie eve};
174174
say @array[*-1]; #-> eve
175+
176+
Yet another way is to utilize the array's tail method:
177+
178+
my @array = qw{victor alice bob charlie eve};
179+
say @array.tail; #-> eve
180+
say @array.tail(2); #-> (charlie eve)
175181
176182
=head2 Typed Array parameters
177183

0 commit comments

Comments
 (0)