Enum Types
Syntax
Enum :
enum
{
EnumMember (,
EnumMember )*,
?}
EnumMember :
`
TYPE_IDENTIFIER ( EnumMemberOfType )?EnumMemberOfType :
(
Type)
Examples:
To represent a direction on a D-pad, you could use the following enum:
enum { `Up, `Down, `Left, `Right }
To represent a user on a website, you could use the following enum:
enum {
`Anon,
`LoggedIn(struct { id: string, role: string }),
}