Quick start manual
Syntactic elements
4-15
Expressions
Examples of set constructors:
[red, green, MyColor]
[1, 5, 10..K mod 12, 23]
['A
'..'Z', 'a'..'z', Chr(Digit + 48)]
For more information about sets, see “Sets” on page 5-18.
Indexes
Strings, arrays, array properties, and pointers to strings or arrays can be indexed. For 
example, if FileName is a string variable, the expression FileName[3] returns the third 
character in the string denoted by FileName, while FileName[I + 1] returns the 
character immediately after the one indexed by I. For information about strings, see 
“String types” on page 5-11. For information about arrays and array properties, see 
“Arrays” on page 5-19 and “Array properties” on page 7-20.
Typecasts
It is sometimes useful to treat an expression as if it belonged to different type. A 
typecast allows you to do this by, in effect, temporarily changing an expression’s 
type. For example, Integer('A') casts the character A as an integer.
The syntax for a typecast is
typeIdentifier(expression)
If the expression is a variable, the result is called a variable typecast; otherwise, the 
result is a value typecast. While their syntax is the same, different rules apply to the 
two kinds of typecast.
Value typecasts
In a value typecast, the type identifier and the cast expression must both be ordinal or 
pointer types. Examples of value typecasts include
Integer('A')
Char(48)
Boolean(0)
Color(2)
Longint(@Buffer)
The resulting value is obtained by converting the expression in parentheses. This 
may involve truncation or extension if the size of the specified type differs from that 
of the expression. The expression’s sign is always preserved.
The statement
I := Integer('A');
assigns the value of Integer('A'), which is 65, to the variable I.
A value typecast cannot be followed by qualifiers and cannot appear on the left side 
of an assignment statement.










