We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7f007f5 commit ed4d87eCopy full SHA for ed4d87e
doc/Type/Method.pod6
@@ -6,11 +6,15 @@
6
7
class Method is Routine { }
8
9
-A type for methods. To create a method, use the C<method> keyword:
+A type for methods. To create a method outside a L<class
10
+definition|/language/typesystem#Methods>, use the declarators C<my> and C<method>:
11
12
my $m = method ($invocant: $param) {
13
say "$invocant: '$param'";
14
}
15
"greeting".$m("hello"); # greeting: 'hello'
16
17
+ <a b c>.&(my method (List:D:){dd self; self}).say;
18
+ # OUTPUT«("a", "b", "c")(a b c)»
19
+
20
=end pod
0 commit comments