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.

BEGIN<br />

END.<br />

print;<br />

*ERROR 96 -- the control variable is not of a type<br />

which defines a range of values<br />

Appendix A<br />

The control variable of a FOR statement must have a type which defines a<br />

range of values (an ordinal type). This type must be integer, char, boolean,<br />

enumerated type, or a subrange type.<br />

PROGRAM fail(output);<br />

VAR x : real;<br />

BEGIN<br />

END.<br />

FOR x := 1 TO 10 DO lx isn't ordinal]<br />

writeln('hello');<br />

*ERROR 97 -- either TO or DOWNTO is required here<br />

When specifying a FOR statement the initial and final values for the<br />

control variable must be separated by either TO or DOWNTO.<br />

PROGRAM fail(output);<br />

VAR j:integer;<br />

BEGIN<br />

END.<br />

FOR j := 1, 10 DO<br />

writeln('hello ' ):<br />

*ERROR 98 -- the initial value cannot be assigned to <br />

The initial value of a FOR loop cannot be assigned to the loop control<br />

variable because it is not of a suitable type or not in the correct<br />

range.<br />

PROGRAM fail(output);<br />

TYPE days =0(sun, mon, tue, wed, thurs, fri, sat);<br />

week = mon..fri;<br />

VAR w : week;<br />

BEGIN<br />

<strong>Pascal</strong> Issue 1 79

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

Saved successfully!

Ooh no, something went wrong!