Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Enumerated Types
◄Ordinal Types► ◄Contents► ◄Index► ◄Back►
( <identifier> [, <identifier>, ...] )
Description
Enumerated data types define a group of one or more related
elements. The compiler treats the elements as an ordinal
type──that is, it assigns successive integral values to each
element. (Integral values are evenly divisible by one.) The first
element is assigned 0. QuickPascal allows 65536 elements in one
enumerated type.
The following example──part of a simulation of an 8086
microprocessor──illustrates one possible use of enumerated types:
TYPE
hardware_interrupts = ( divide_by_zero, single_step,
nonmaskable, breakpoint, overflow );
VAR
hardware_interrupt : hardware_interrupts;
.
.
CASE hardware_interrupt OF
divide_by_zero : recover( hardware_interrupt );
single_step : debug( hardware_interrupt );
nonmaskable : recover( hardware_interrupt );
breakpoint : debug( hardware_interrupt );
overflow : recover( hardware_interrupt );
ELSE error
END;
Elements of an enumerated type can be tested for equality (=, <=,
or >=) and order (Ord, Pred, Succ).