Enumeration Definitions

An enumeration is a list of named numbers. By default they decay to the type int, but the default decay type can be set manually.

EnumerationDefinition

enum Identifier (: IntegerType)? { EnumeratorList ,? } ;?

Enumerator Lists

EnumeratorList

Enumerators

Enumerators can either be incremental — from the last enumerator, or 0 if there is none — or explicitly set.

Enumerator

Identifier (= ConstantExpression)?

Examples

Enumeration Definitions

// Basic enumeration.
enum MyCoolEnum
{
	A_THING, // Has value int(0) ...
	BEES, // ... 1 ...
	CALCIUM, // ... 2 ...
	DEXTROSE, // ... and 3.
}
// Less trivial example.
enum MyCoolerEnum : int16
{
	A = 500, // Has value int16(500),
	B, // 501,
	C = 200,
	D, // 201,
	E, // and 202.
}