Documentation for method keyof
Documentation for method keyof, assembled from the following types:
Returns the type constraint for the keys of the invocant. For normal hashes the method returns the coercion type
(Str(Any)) while for object hashes the type used in the declaration of the
Hash is returned.
my = 'apples' => 3, 'oranges' => 7; # (no key type specified)say .keyof; # OUTPUT: «(Str(Any))␤»my = 'oranges' => 7; # (keys must be of type Str)say .keyof; # (Str)= 'apples'; # throws exceptionCATCH ;# OUTPUT: «X::TypeCheck::Binding: Type check failed in binding to key; expected Str but got Int (3)␤»