VMS Help PASCAL, Data Types, Structured Types, SET, Set constructor *Conan The Librarian (sorry for the slow response - running on an old VAX) |
Set constructors are lists of values that you can use to initialize a set. The syntax for set constructors is as follows: [[data-type]] [ [[{component-value},...]] ] The 'data-type' is the data type of the constructor. This identifier is optional when used in the CONST and executable sections; do not use this identifier in the TYPE and VAR sections or in nested constructors. The 'component-value' specifies values within the range of the defined data type. Component values can be subranges (..) to indicate consecutive values that appear in the set definition. These values are compile-time values; if you use the constructor in the executable section, you can also use run-time values. A set having no elements is called an empty set and is written as empty brackets ([]). A possible constructor for a variable of type SET OF 35..115 is the following: VAR Numbers : SET OF 35..115 VALUE [39, 67, 110..115]; {In the executable section, run-time expressions are legal:} Numbers := [39, 67, x+95, 110..115] The set constructors contain up to nine values: 39, 67, 95 or x+95, and integers between 110 and 115, inclusive. If the expression x+95 evaluates to an integer outside the range 35..115, then Compaq Pascal includes no set element for that expression.
|