Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Document Enumeration.Int
  • Loading branch information
Altai-man committed May 17, 2019
1 parent 3bbea96 commit 619fa6a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions doc/Type/Enumeration.pod6
Expand Up @@ -167,6 +167,23 @@ Defined as:
=for code :preamble<enum Norse-gods <Þor Oðin Freija>;>
say Oðin.succ; # OUTPUT: «Freija␤»
=head2 method Int
Defined as:
multi method Int(::?CLASS:D:)
Takes a value of an enum and returns it after coercion to C<Int>:
enum Numbers <One Two Three>;
say Two.Int; # OUTPUT: «1␤»
enum Numbers ( cool => '42', almost-pi => '3' )
say cool.Int; # OUTPUT: «42␤»
say almost-pi.Int; # OUTPUT: «3␤»
Note that if the value cannot be coerced to C<Int>, an exception will
be thrown.
=head2 method C<===>
Defined as
Expand Down

0 comments on commit 619fa6a

Please sign in to comment.