sub echo(Int $x) { say $x.^name; say "echo() received $x"; } echo(3); --output:-- Int echo() received 3 #### sub echo(Int $x) { say $x.^name; } echo(Int); --output:-- Int #### sub echo(Int:D $x) { say $x.^name; } echo(Int); --output:-- Parameter '$x' of routine 'echo' must be an object instance of type 'Int', not a type object of type 'Int'. Did you forget a '.new'? in sub echo at b.raku line 14 in block at b.raku line 18 #### sub echo(Int:U $x) { say $x.^name; } echo(3); --output:-- Parameter '$x' of routine 'echo' must be a type object of type 'Int', not an object instance of type 'Int'. Did you forget a 'multi'? in sub echo at b.raku line 14 in block at b.raku line 22 #### multi sub echo(Int:U $x) { say $x.^name; } multi sub echo(Int:D $x) { say $x.^name; } echo(3); #### sub echo(Int:D: $x) { say $x.^name; } echo(3); --output:-- ===SORRY!=== Error while compiling /Users/7stud/raku_programs/b.raku Can only use the : invocant marker in the signature for a method at /Users/7stud/raku_programs/b.raku:14 ------> sub echo(Int:D: $x⏏) { expecting any of: constraint #### class Dog { has Str $.name; method bark(Int:D $x) { say self.^name; # self is an implicit variable that refers to the invocant say "bark" for 1..$x; } } my $d = Dog.new(name => "Rover"); $d.bark(3); ---output:-- Dog bark bark bark #### class Dog { has Str $.name; method bark($dog: Int:D $x) { say $dog.^name; # $dog is an explicit variable that refers to the invocant say $dog.name; say "bark" for 1..$x; } } my $d = Dog.new(name => "Rover"); $d.bark(3); --output:-- Dog Rover bark bark bark #### class Dog { has Str $.name; method bark(Dog:D:dog: Int $x) { say $dog.^name; say $dog.name; say "bark" for 1..$x; } } #### class Dog { has Str $.name; method bark(Dog:D: Int:D $x) { say self.^name; say "bark" for 1..$x; } } my $d = Dog.new(name => "Rover"); $d.bark(3); #### class Dog { has Str $.name; method bark(Dog:D: Int:D $x) { say self.^name; say "bark" for 1..$x; } } Dog.bark(3); --output:-- Invocant of method 'bark' must be an object instance of type 'Dog', not a type object of type 'Dog'. Did you forget a '.new'? in method bark at b.raku line 30 in block at b.raku line 36 #### class Dog { has Str $.name; method bark(Int:D $x) { say self.^name; say "bark" for 1..$x; } } Dog.bark(3); --output:-- Dog bark bark bark #### class Dog { has Str $.name; method bark(Dog:D $dog: Int:D $x) { say $dog.^name; say $dog.name; say "bark" for 1..$x; } } my $d = Dog.new(name => 'Rover'); $d.bark(3); Dog.bark(3); --output:-- Dog Rover bark bark bark Invocant of method 'bark' must be an object instance of type 'Dog', not a type object of type 'Dog'. Did you forget a '.new'? in method bark at b.raku line 30 in block at b.raku line 39 #### routine chr multi sub chr(Int:D --> Str:D) multi method chr(Int:D: --> Str:D) #### 32] > chr(99); c #### [33] > 99.chr c #### my method m(Int:D: $b){ say self.^name } my $i = 1; $i.&m(); # OUTPUT: «Int»