isa
ErrorsCollection

isa

Synthesised documentation from type/Mu

From type/Mu

See Original text in context

multi method isa(Mu $type     --> Bool:D)
multi method isa(Str:D $type  --> Bool:D)

Returns True if the invocant is an instance of class $type, a subset type or a derived class (through inheritance) of $type. does is similar, but includes roles.

my $i = 17;
say $i.isa("Int");   # OUTPUT: «True␤» 
say $i.isa(Any);     # OUTPUT: «True␤» 
role Truish {};
my $but-true = 0 but Truish;
say $but-true.^name;        # OUTPUT: «Int+{Truish}␤» 
say $but-true.does(Truish); # OUTPUT: «True␤» 
say $but-true.isa(Truish);  # OUTPUT: «False␤»