Variant Parts in Records A record type can have a variant part, which looks like a case statement. The variant part must follow the other fields
in the record declaration.
To declare a record type with a variant part, use the following syntax.
type recordTypeName = record
fieldList1: type1;
...
fieldListn: typen;
case tag: ordinalType of
constantList1: (variant1);
...
constantListn: (variantn);
end;
The first part of the declaration - up to the reserved word case - is the same as that of a standard record type. The
remainder of the declaration - from case to the optional final semicolon - is called the variant part. In the variant part,
tag is optional and can be any valid identifier. If you omit tag, omit the colon (:) after it as well.
ordinalType denotes an ordinal type.
Each constantList is a constant denoting a value of type ordinalType, or a comma-delimited list of such
constants. No value can be represented more than once in the combined constantLists.
83
Each variant is a semicolon-delimited list of declarations resembling the fieldList: type constructions in the main