Skip to content

Commit 41d9fd2

Browse files
authored
routine elems, routine end (prev had only method form) (#4773)
1 parent 7a9e889 commit 41d9fd2

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

doc/Type/Any.rakudoc

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -326,29 +326,36 @@ returns that L<C<List>|/type/List>.
326326
say $range; # OUTPUT: «1..5␤»
327327
say $range.eager; # OUTPUT: «(1 2 3 4 5)␤»
328328

329-
=head2 method elems
329+
=head2 routine elems
330330

331331
multi method elems(Any:U: --> 1)
332332
multi method elems(Any:D:)
333+
multi elems($a)
334+
multi elems(array:D \a)
333335

334-
Interprets the invocant as a list, and returns the number of elements in the
335-
list.
336+
Interprets the invocant or argument as a list, and returns the number of
337+
elements in the list.
336338

337-
say 42.elems; # OUTPUT: «1␤»
339+
say elems 42; # OUTPUT: «1␤»
338340
say <a b c>.elems; # OUTPUT: «3␤»
339341
say Whatever.elems ; # OUTPUT: «1␤»
340342

341343
It will also return 1 for classes.
342344

343-
=head2 method end
345+
=head2 routine end
344346

345347
multi method end(Any:U: --> 0)
346348
multi method end(Any:D:)
349+
multi end($a)
350+
multi end(array:D \a)
351+
multi end($, *%)
347352

348-
Interprets the invocant as a list, and returns the last index of that list.
353+
Interprets the invocant or argument as a list, and returns the last index of
354+
that list.
349355

350356
say 6.end; # OUTPUT: «0␤»
351357
say <a b c>.end; # OUTPUT: «2␤»
358+
say end ^9; # OUTPUT: «8␤»
352359

353360
=head2 method pairup
354361

0 commit comments

Comments
 (0)