Skip to content

Commit 1fb27c0

Browse files
author
Jan-Olof Hendig
committed
Added docs for method 'isa' in Mu. #perl6++
1 parent fcd329e commit 1fb27c0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

doc/Type/Mu.pod

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,22 @@ C<False> even for instances:
3232
sub fails() { fail 'oh noe' };
3333
say fails().defined; # False
3434
35+
=head2 routine isa
36+
37+
multi method isa(Mu $type) returns Bool:D
38+
multi method isa(Str:D $type) returns Bool:D
39+
40+
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>.
41+
42+
my $i = 17;
43+
say $i.isa("Int"); # True
44+
say $i.isa(Any); # True
45+
46+
A more idiomatic way to do this is to use the smartmatch operator L<~~|/routine/~~> instead.
47+
48+
my $s = "String";
49+
say $s ~~ Str; # True
50+
3551
=head2 routine Bool
3652
3753
multi sub Bool(Mu) returns Bool:D

0 commit comments

Comments
 (0)