Skip to content

Commit f6a1eb5

Browse files
committed
Document Mu.take()
1 parent ef84a44 commit f6a1eb5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/Type/Mu.pod

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,4 +242,19 @@ Marks a type as being exported, that is, available to external users.
242242
A user of a module or class automatically gets all the symbols imported that
243243
are marked as C<is export>.
244244
245+
=head2 method take
246+
247+
method take()
248+
249+
Takes the given item and passes it to the enclosing C<gather> block.
250+
251+
#| randomly select numbers for lotto
252+
my $num-selected-numbers = 6;
253+
my $max-lotto-numbers = 49;
254+
gather for ^$num-selected-numbers {
255+
take (1 .. $max-lotto-numbers).pick(1);
256+
}.say; #-> 32 22 1 17 32 9 (for example)
257+
245258
=end pod
259+
260+
# vim: expandtab shiftwidth=4 ft=perl6

0 commit comments

Comments
 (0)