Skip to content

Commit b373bcf

Browse files
committed
doc sub take-rw
1 parent 8b565ab commit b373bcf

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

doc/Type/Mu.pod6

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,18 @@ Takes the given item and passes it to the enclosing C<gather> block.
337337
take (1 .. $max-lotto-numbers).pick(1);
338338
}.say; #-> 32 22 1 17 32 9 (for example)
339339
340+
=head2 routine take-rw
341+
342+
sub take-rw(\item)
343+
344+
Returns the given item to the enclosing C<gather> block, without introducing a new container.
345+
346+
my @a = 1...3;
347+
sub f(@list){ gather for @list { take-rw $_ } };
348+
for f(@a) { $_++ };
349+
say @a;
350+
# OUTPUT«[2 3 4]␤»
351+
340352
=head2 method so
341353
342354
method so()

0 commit comments

Comments
 (0)