Enumerations

Enumerations are used to define sets of identifiers, which have constant integer values.

An integer can be assigned to each constant of the enumerated 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 variable is a number matched with the corresponding constant.

A variable of the enumerated type can take values of that enumerated type only.

Example

Enum MyEnum1
    
//Constants will have values 0, 1, 2 respectively
    MyValue1, MyValue2, MyValue3
End Enum MyEnum1;

Public Enum MyEnum2
    
//Constants will have values assigned to them
    MyValue1 = 0, MyValue2 = 8, MyValue3 = 16
End Enum MyEnum2;

See also:

Fore Language Guide | Classes and Objects | Interfaces