Last active
May 23, 2016 20:25
Attempt to document method 'isa' in Mu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=head2 routine isa | |
multi method isa(Mu $type) returns Bool:D | |
multi method isa(Str:D $type) returns Bool:D | |
Returns C<True> if the invocant is an instance of class C<$type>, a subset type or a derived class (through inheritance) of C<$type>. | |
my $i = 17; | |
say $i.isa("Int"); # True | |
say $i.isa(Any); # True | |
A more idiomatic way to do this is to use the smartmatch operator C<~~>. | |
my $s = "String"; | |
say $i ~~ Str; # True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment