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 111 PRED needs a parameter of a type which defines<br />

a range of values<br />

The parameter given to PRED may only be of an ordinal type, that is<br />

integer, char, boolean, an enumerated type or a subrange.<br />

PROGRAM fail;<br />

VAR val : real;<br />

BEGIN<br />

END.<br />

val := PRED(val);<br />

*ERROR 112 -- SUCC needs a parameter of a type which defines<br />

a range of values<br />

The parameter given to SUCC may only be of an ordinal type, that is<br />

integer, char, boolean, an enumerated type or a subrange.<br />

PROGRAM fail;<br />

VAR val : real;<br />

BEGIN<br />

END.<br />

val := SUCC(val);<br />

*ERROR 113 -- TRUNC needs a real type parameter<br />

The parameter given to TRUNC must be of real type. Note that even<br />

though an integer value can often be used in the context of a real value the<br />

standard does not permit integer parameters for TRUNC.<br />

PROGRAM fail;<br />

VAR x : real;<br />

BEGIN<br />

END.<br />

n, m : integer;<br />

x := 1.54;<br />

m := TRUNC(x);<br />

n := TRUNC(m); [sadly, not permitted}<br />

m := TRUNC(TRUE); [just rubbish}<br />

84 <strong>Pascal</strong> Issue 1

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

Saved successfully!

Ooh no, something went wrong!