You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/Language/traps.rakudoc
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -492,7 +492,7 @@ say 12_345.contains("2_"); # OUTPUT: «False»
492
492
493
493
A common task is to retrieve one or more random elements from a collection,
494
494
but C<List.rand> isn't the way to do that. L<C<Cool>|/type/Cool> provides
495
-
L<rand|/type/Cool#routine_rand>, but that first coerces the L<C<List>|/type/List> into
495
+
L<rand|/type/Cool#method_rand>, but that first coerces the L<C<List>|/type/List> into
496
496
the number of items in the list, and returns a random real number
497
497
between 0 and that value. To get random elements, see L<pick|/routine/pick>
498
498
and L<roll|/routine/roll>.
@@ -1295,7 +1295,7 @@ say doesn't-return-ret;
1295
1295
# BAD: outputs «Nil» and a warning «Useless use of constant string "ret" in sink context (line 13)»
1296
1296
=end code
1297
1297
1298
-
Code for C<returns-ret> and C<doesn't-return-ret> might look exactly the same, since in principle it does not matter where the L<C<CATCH>|/language/phasers#index-entry-Phasers__CATCH-CATCH> block goes. However, a block is an object and the last object in a C<sub> will be returned, so the C<doesn't-return-ret> will return L<C<Nil>|/type/Nil>, and, besides, since "ret" will be now in sink context, it will issue a warning. In case you want to place phasers last for conventional reasons, use the explicit form of C<return>.
1298
+
Code for C<returns-ret> and C<doesn't-return-ret> might look exactly the same, since in principle it does not matter where the L<C<CATCH>|/language/phasers#CATCH> block goes. However, a block is an object and the last object in a C<sub> will be returned, so the C<doesn't-return-ret> will return L<C<Nil>|/type/Nil>, and, besides, since "ret" will be now in sink context, it will issue a warning. In case you want to place phasers last for conventional reasons, use the explicit form of C<return>.
1299
1299
1300
1300
=begin code
1301
1301
sub explicitly-return-ret () {
@@ -1309,7 +1309,7 @@ sub explicitly-return-ret () {
1309
1309
=head2 C<LEAVE> needs explicit return from a sub to run
0 commit comments