ISO Pascal reference manual
ISO Pascal reference manual
ISO Pascal reference manual
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
PROGRAM fail;<br />
VAR n : integer;<br />
FUNCTION one:integer;<br />
BEGIN<br />
one := 1; [correct}<br />
END;<br />
BEGIN<br />
n := one; (correct}<br />
one := 1; (incorrect - not inside 'one'}<br />
END.<br />
*ERROR 135 -- function cannot be used in this way<br />
Appendix A<br />
This message is issued when a required function is used as though it were a<br />
variable.<br />
PROGRAM fail;<br />
BEGIN<br />
sqrt := 0;<br />
END.<br />
*ERROR 136 -- the type of the array index does not match the type<br />
given in the array declaration<br />
The expression used to select an element of an array must give a value<br />
which is of the same type as was used to declare the array.<br />
PROGRAM fail(output);<br />
TYPE person = (fred, fill, anne, jim);<br />
VAR who : person;<br />
lucky : ARRAY [person] of Boolean;<br />
BEGIN<br />
IF lucky[who] THEN writeln('yes')<br />
(OK - who is 'person'-type}<br />
IF lucky[true] THEN writeln('no')<br />
[wrong - true is not 'person'-type}<br />
END.<br />
<strong>Pascal</strong> Issue I 93