At this point, the compiler demanded an ordinal type. The predefined types Integer, Char, WideChar, Boolean, and specified enumerated kinds are known as ordinal types.
Ordinal types are needed in a variety of situations:
An array’s index type must be ordinal.
The low and high bounds of a subrange type must be ordinal type constant expressions.
An ordinal type must be the element type of a set.
A case statement’s selection phrase must be of ordinal type.
A variable of either ordinal or pointer type must be the first parameter to the standard operations Inc and Dec.
program Produce; type TByteSet = set of 0..7; var BitCount: array [TByteSet] of Integer; begin end.
An array’s index type must be an ordinal type; type TByteSet is a set, not an ordinal type.
program Solve; type TByteSet = set of 0..7; var BitCount: array [Byte] of Integer; begin end.
As the array index type, specify an ordinal type.
Leave a Reply