Enumerations


An enumeration is a collection of named integer constants. The general form of an enumeration is shown below.

enum name { enumeration-list }

The name of the enumeration is specified by name. An enumeration defines a new type as specified by this name. The enumeration list is a list of iidentifiers.

An example of an enumeration is shown below.

space sampleI
{
    enum greek
    {
        alpha
        beta
        gamma
    }

    sampleI()
    {
       variable = greek.alpha

       select variable
       {
            alpha
            {
                cout << "hello" << "\n"
            }

            beta
            {
                cout << "world" << "\n"
            }
        }
    }
}

Note that there is a special relationship between enumerations and the select statement. The enumerators occuring in cases of the select statement do not have to be qualified and can be used as shown above.