Skip to content

Latest commit

 

History

History
35 lines (27 loc) · 816 Bytes

File metadata and controls

35 lines (27 loc) · 816 Bytes

Enum

Syntax
Enumeration :
   enum IDENTIFIER {
   EnumField*
   }

EnumField :
   IDENTIFIER

An enumeration, also referred to as enum is a simultaneous definition of a nominal enumerated type, that can be used to create or pattern-match values of the corresponding enumerated type.

Enumerations are declared with the keyword enum.

An example of an enum item and its use:

enum Animal {
    Dog
    Cat
}

fn f() {
    let barker: Animal = Animal::Dog
}

NOTE: Enums are not yet implemented.