Delphi: How to have non-contiguous subrange enumeration type?

delphi, enums, pascal, range

Solution

Unfortunately, I don't think there's any way to do that. You can declare a (new) non-contiguous enumeration, or a subrange of an existing type, but not both.

Problem

While the following subrange enumeration declaration works: ``` type TReceiptCode = 'A'..'F'; ``` This does not: ``` type TReceiptCode = ' ','A'..'F', 'R'; ``` Nor does ``` type TReceiptCode = ' ','A','B','C','D','E','F','R'; ``` How can i declare a subrange type with non-contiguous values?

Original source