$EnumDeclaration = ENUM ident EnumMembers END ENUM ident ";"
$EnumMembers = EnumMember [ {“,” EnumMember} ]
$EnumMember = ident [“=” ConstExpression ]
Enumerations allow sets of identifiers to be defined, which have integer values.
An integer can be assigned to each constant of the enumerable type. If the value is not explicitly specified by the user, it is considered equal to the value of the previous constant plus 1. For the first constant, the default value is 0. Constant values must be unique. The value of each constant must be greater than the value of the previous constant.
The values of the enumerable type can be assigned to variables of the integer type. In this case the value of the integer variable is a number assigned to the previous constant.
A variable of the enumerable type can take values of that enumerable type only.
Enum MyEnum1
MyValue1, MyValue2, MyValue3
End Enum MyEnum1;
Enum MyEnum2
MyValue1 = 0, MyValue2 = 8, MyValue3 = 16
End Enum MyEnum2;
See also: