HP Pascal/iX Reference Manual (31502-90022)

5:- 7
Example
TYPE
digits = SET OF 0..9;
charset = SET OF char;
CONST
all_digits = digits [0..9]; { Subrange. }
odd_digits = digits [1, 1+2, 5, 7, 9];
letters = charset ['a'..'z', 'A'..'Z'];
no_chars = charset [ ];
no_iden = [2, 4, 6, 8] { No set identifier. }
String Constructor
A string constant is a declared constant defined with a
string
constructor
that specifies values for a string type. The length of the
string constant may not exceed the maximum length of the string type used
in its definition. The number of characters in the definition determines
the current length of the string constant.
A string constructor consists of a previously defined string type
identifier and a list of values in square brackets. Note that string
constructors are only legal in a CONST section of a declaration part.
They cannot appear in other sections or in executable statements.
Within the square brackets, the reserved word OF indicates that a value
occurs repeatedly. For example, 3 OF 'a' assigns the character a to
three successive string components. The symbols (. and .) may replace
the left and right square brackets, respectively. String literals of
more than one character may appear as values.
A string constant may be used to initialize a variable in the statement
part of a block. Individual components of a string constant in the body
of the block may be accessed, but not in the definition of other declared
constants.
Syntax
String_constructor: