Skip to content

Commit b25e802

Browse files
committed
Add cando example with Block
1 parent 3bbea96 commit b25e802

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

doc/Type/Code.pod6

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ Returns a list of candidates that can be called with the given
145145
L<Capture|/type/Capture>. Since C<Code> objects do not have any multiple
146146
dispatch, this either returns a list with the object, or an empty list.
147147
148+
my $single = \'a'; # a single argument Capture
149+
my $plural = \'a', 42; # a two argument Capture
150+
my &block = { say $^a }; # a Block object, that is a subclass of Code, taking one argument
151+
say &block.cando($single); # OUTPUT: «(-> $a { #`(Block|94212856419136) ... })␤»
152+
say &block.cando($plural); # OUTPUT: «()␤»
153+
148154
=head2 method Str
149155
150156
Defined as:

0 commit comments

Comments
 (0)