Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Enumeration Declarations

Enumerations are named global declarations, subject to the behavior described here.

Resultant Symbol

References to enumeration declarations resolve to the declared enumeration type value, with the declared variants.

Assertions

  1. Each variant's payload type expression is a value of the type type.
  2. Each variant's payload type is runtime representable.
  3. Each variant's name is unique within the enumeration.

Syntax

enumeration_declaration_variant = identifier, [ colon, expression ], semicolon ;

enumeration_declaration = enum, identifier, left_brace, { enumeration_declaration_variant }, right_brace ;