πŸ“˜ Method postfix operator .? in Perl 6

πŸ“˜ Method postfix operator .? in Raku

N. B. Perl 6 has been renamed to Raku. Click to read more.


.?method calls a method if it is defined. If the object does not have a method with the given name, Nil is returned.

class C {
Β Β Β  method m() {'m'}
}Β 

my $c = C.new();
say $c.?m(); # m
say $c.?n(); # Nil

Leave a Reply

Your email address will not be published. Required fields are marked *

Retype the CAPTCHA code from the image
Change the CAPTCHA codeSpeak the CAPTCHA code