Skip to content

Commit c0b61c9

Browse files
authored
Add example for .multi
And mention the thing where &foo is a proto and its multi returns false
1 parent cadaf58 commit c0b61c9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

doc/Type/Routine.pod6

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,14 @@ Returns the package in which the routine is defined.
6161
6262
method multi(Routine:D: --> Bool:D)
6363
64-
Returns C<True> if the routine is a multi sub or method.
64+
Returns C<True> if the routine is a multi sub or method. Note that
65+
the name of a multi sub refers to its proto and this method would
66+
return false if called on it. It needs to be called on the
67+
candidates themselves:
68+
69+
multi foo ($, $) {};
70+
say &foo.multi # OUTPUT«False␤»
71+
say &foo.candidates».multi # OUTPUT«(True)␤»
6572
6673
=head2 method candidates
6774

0 commit comments

Comments
 (0)