Page:
Enum Definitions
Pages
Arguments
Body
Control Flow
Data
Enum Definitions
Error Handling
File Structure
Functions and Methods
General Syntax
Guidelines
Home
How to Parse
Identifiers
Interface Definitions
Metadata
Modules
Object Type Definitions
Permissions
Phrases
Return Direction
Style Guide
Tokens
Type Definitions
Type Specifiers
Variable Definition
1
Enum Definitions
Sasha Koshka edited this page 2022-09-19 04:39:56 +00:00
Syntax
enum ro Weekday:Int
- sunday
- monday
- tuesday
- wednesday
- thursday
- friday
enum ro NamedColor:U32
- red: <0xFF0000>
- green: <0x00FF00>
- blue: <0x0000FF>
Each line under an enum represents a member and is composed of a name, and an optional value.
Enum members are accessed similarly to object members:
set day:Weekday Weekday.thursday
Semantics
Enums "enumerate" a pre-existing type, most likely an Int.
Enum members can have explicitly defined values, but if they don't, their value is just incremented up from zero. The order in which members are listed in matters.
- Home Page
- List of Pages
- Guidelines
- Language Reference/Design Spec
- Compiler Design