Skip to content

Commit

Permalink
Document how to change base type of an enum (#9803)
Browse files Browse the repository at this point in the history
Co-authored-by: Johannes Müller <[email protected]>
  • Loading branch information
Blacksmoke16 and straight-shoota authored Sep 26, 2022
1 parent a6704ab commit 3e13d0e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/enum.cr
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,20 @@
# puts "Got blue"
# end
# ```
#
# ### Changing the Base Type
#
# The type of the underlying enum value is `Int32` by default, but it can be changed to any type in `Int::Primitive`.
#
# ```
# enum Color : UInt8
# Red
# Green
# Blue
# end
#
# Color::Red.value # : UInt8
# ```
struct Enum
include Comparable(self)

Expand Down

0 comments on commit 3e13d0e

Please sign in to comment.