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.

PROGRAM fail(output);<br />

CONST one = 1;<br />

BEGIN<br />

WITH one DO (one is not a record variable}<br />

writeln('oops');<br />

END.<br />

*ERROR 41 -- this is not a record<br />

One of the items following WITH is not a record variable.<br />

PROGRAM fail(output);<br />

VAR r : RECORD x,y,z : integer END;<br />

BEGIN<br />

WITH r DO BEGIN (ok}<br />

WITH y DO writeln('oops'); by isn't a record}<br />

END;<br />

END.<br />

*ERROR 42 -- label is no longer a valid destination for<br />

a GOTO statement<br />

A GOTO statement is not permitted to transfer control into a compound<br />

statement from outside; it may only jump within a compound statement or<br />

out of it.<br />

PROGRAM fail;<br />

LABEL 1, 2;<br />

VAR x : integer;<br />

BEGIN<br />

IF x 0 THEN BEGIN<br />

IF x = 1 THEN GOTO 1; (valid}<br />

GOTO 2; (valid - jumping outwards}<br />

1: x := x+1;<br />

END ELSE BEGIN<br />

GOTO 1 [invalid - jumping inwards}<br />

END;<br />

2: x := 0;<br />

END.<br />

58 <strong>Pascal</strong> Issue 1

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

Saved successfully!

Ooh no, something went wrong!