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.