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.

enum greek
{
  alpha
  beta
  gamma
}


generic sampleI
{
  sampleI()
  {
     variable = greek.alpha

     select variable // this is a binary operation.
     {
         case alpha
         {
             s = "hello"
             s.println()
         }
         case beta
         {
             s = "world"
             s.println()
         }
     }
   }
}

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