A set is a collection of elements of the same type. The differences
between arrays and sets are that a set can only hold up to 256 elements
and that sets and arrays can hold different types. Sets can hold characters,
enumerated types or subranges. Integers are not allowed because they exceed
the cardinality of 256, but a subrange of integers can be used.
Syntax
type identifier = set of base_type_identifier;
-
A set does not have the values stated in its declaration, it only is allowed
to have them. Therefore, before the first use of the set, the set should
have been initialized.
-
A set is unordered and each element of a set can only be included once.
-
Removing an element from an empty set does not raise an error, nothing
occurs.
Examples:
type |
characterset = set of char; |
weekdays = (monday,tuesday,wednesday,thursday,friday); |
days = set of weekdays; |
byte = 0..255; |
byteset = set of byte; |
|