method enums

Documentation for method enums, assembled from the following types:

language documentation Typesystem

From Typesystem

(Typesystem) method enums

Defined as:

method enums()

Returns the list of enum-pairs. Works both on the enum type and any key.

enum Mass ( mg => 1/1000=> 1/1kg => 1000/1 );
say Mass.enumsg.enums# OUTPUT: «{g => 1, kg => 1000, mg => 0.001}{g => 1, kg => 1000, mg => 0.001}␤» 

enum Bool

From Bool

(Bool) routine enums

method enums(--> Hash:D)

Returns a Hash of enum-pairs. Works on both the Bool type and any key.

say Bool.enums;                                   # OUTPUT: «{False => 0, True => 1}␤» 
say False.enums;                                  # OUTPUT: «{False => 0, True => 1}␤»