HP Pascal/iX Reference Manual (31502-90022)

8- 3
{ Perform an alternate validity check on x, y, z }
{ and return appropriate value. }
END;
PROCEDURE read_data (FUNCTION check (a, b, c: real): Boolean);
VAR p, q, r: real;
BEGIN
{ read and validate data }
readln (p, q, r);
IF check (p, q, r) THEN ...
END;
BEGIN {show_formparm}
.
IF test THEN read_data (chek1)
ELSE read_data (chek2);
.
END.
PROGRAM show_varparm(output);
VAR
i,j : integer;
PROCEDURE fix(VAR a : integer; b : integer);
BEGIN
a := b; { i is passed by reference; it will return equal to 42.}
b := 0; { j is passed by value; this assignment will }
{ not change the value of j in the main program. }
END;
BEGIN { show_varparm }
i:= 0;
j:= 42;
fix(i,j);
IF i = j THEN writeln('They both = 42');
END.
PROGRAM show_conformantparm;
CONST
First=1;
Last=10;
TYPE
inxtype=1..100;
arr1=ARRAY[First..Last] of Integer;
arr2=ARRAY[First..2*Last] of Integer;
VAR
a1,a2,a3:arr1;
b1,b2,b3:arr2;
PROCEDURE ADD_Array(
VAR Result:ARRAY[L..U:inxtype] OF INTEGER;
P1,P2:ARRAY[L1..U1:inxtype] OF INTEGER
);
VAR
inx:inxtype;
BEGIN { ADD_Array }
IF (L=L1) AND (U=U1) THEN
FOR inx:=L TO U DO
Result[inx]:=P1[inx]+P2[inx]
ELSE
{ handle the error }
END; { Add_Array }
BEGIN { Show_ConformantParm }
{ Initialize values for a1,a2,b1,b2 }