Language:
Русский
English
Enumerated types
Enumerated types define ordered sets of values by enumerating the identifiers that denote these values. Their ordering follows the sequence in which the identifiers are enumerated.
Syntax
type
name = (identifier,
identifier, ...,
identifier );
Remarks
The identifiers in the type definition become constants of the enumerated type.
The first constant has an ordinality of 0, the second has an ordinality of 1, the third an ordinality of 2, and so on.
Enumerated types are a subclass of the ordinal types.
Example
type
Suit = (Club, Diamond, Heart, Spade);
Given this declaration, Heart is a constant of type Suit.
The Ord standard function returns the ordinality of an enumerated constant. In this example,
Ord(Club) = 0
Ord(Diamond) = 1
Ord(Heart) = 2
and so on.