Set types

[next] [prev] [prev-tail] [tail] [up]

#### 3.3.3 Set types

Free Pascal supports the set types as in Turbo Pascal. The prototype of a set declaration is:

_________________________________________________________________________________________________________
Set Types
___________________________________________________________________

Each of the elements of SetType must be of type TargetType. TargetType can be any ordinal type with a range between 0 and 255. A set can contain at most 256 elements. The following are valid set declaration:

Type
Junk = Set of Char;
Days = (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
Var
WorkDays : Set of days;

Given these declarations, the following assignment is legal:

WorkDays := [Mon, Tue, Wed, Thu, Fri];

Several operations can be done on sets: taking unions or differences, adding or removing elements, comparisons. These are documented in section 12.8.6, page 639

How the compiler stores sets depends on the mode and can be controlled with a directive. For more information, see the programmer’s guide.

[next] [prev] [prev-tail] [front] [up]