28.06.2013 Views

ISO Pascal reference manual

ISO Pascal reference manual

ISO Pascal reference manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

*ERROR 91 -- this is not a valid case selector<br />

Appendix A<br />

This message is issued when the extended forms of NEW or DISPOSE are<br />

used and the extra parameters do not correspond to the variables in the<br />

CASE parts of the record description.<br />

PROGRAM fail;<br />

BEGIN<br />

END.<br />

TYPE three = 1..3;<br />

rec = RECORD CASE x:three of<br />

END;<br />

point =trec;<br />

VAR thing : point;<br />

1:(a : integer);<br />

2:(b : real);<br />

3:(c : char);<br />

new(thing, 2); (2 is ok for x above(<br />

new(thing, 4); (but 4 is not(<br />

*ERROR 92 -- this statement threatens to alter the loop control<br />

variable <br />

The control variable of a FOR loop may not be used inside the body of the<br />

loop in such a way as to threaten to alter it. This means that the variable<br />

cannot appear to the left of : = , as a VAR parameter or as the control<br />

variable of a nested FOR statement. Note that the error only indicates that<br />

the variable is threatened; it is still an error even though the variable can<br />

never actually be altered.<br />

PROGRAM fail(input);<br />

VAR j, k : integer;<br />

BEGIN<br />

END.<br />

FOR j := 1 to 10 DO BEGIN<br />

END;<br />

read(k)<br />

IF k = 0 THEN j := 10 (wrong}<br />

<strong>Pascal</strong> Issue 1 77

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

Saved successfully!

Ooh no, something went wrong!