28.06.2013 Views

ISO Pascal reference manual

ISO Pascal reference manual

ISO Pascal reference manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

*ERROR 57 -- the objects in the set constructor do not all have<br />

the same type<br />

When square brackets are used to construct a set value, the expressions<br />

contained within must all yield values of the same type.<br />

PROGRAM fail;<br />

TYPE t1 = (this, that, other);<br />

t2 = (here, there, everywhere);<br />

VAR s : SET OF t1;<br />

BEGIN<br />

END.<br />

s := [this, there, that]; ['there' is the wrong type}<br />

*ERROR 58 -- the operands of are of unsuitable types<br />

The operator < item > has been given operands to which it cannot be<br />

applied.<br />

PROGRAM fail;<br />

VAR a, b, c : char;<br />

BEGIN<br />

END.<br />

a := b + c; [chars cannot be added together}<br />

*ERROR 59 -- the operands for are of incompatible types<br />

The operator < item > has been used to operate upon operands of<br />

different and incompatible types.<br />

PROGRAM fail;<br />

VAR c : boolean;<br />

BEGIN<br />

END.<br />

s : SET OF char;<br />

IF c IN s THEN writeln; [c is not a char}<br />

*ERROR 60 -- this type does not define a range of values<br />

Certain types in <strong>Pascal</strong>, known as 'ordinal types', define ranges of values.<br />

These types are: integer, char, boolean and all enumerated types. In<br />

64 <strong>Pascal</strong> Issue 1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!