VAL/VAR parameters.
MODULE D1;
<* NOOPTIMIZE + *>
FROM IO IMPORT RdChar, WrChar, WrStr, RdStr,
WrLn, RdCard, WrCard, RdInt, WrInt, RdReal, WrReal, RdBool, WrBool;
FROM RealMath IMPORT sqrt, exp, sin, cos, tan,
arcsin, arccos, arctan, power, round;
PROCEDURE Do(VAR x: CARDINAL; y: CARDINAL);
(*
Note the VAR parameters *)
(* change x & y between VAL & VAR *)
BEGIN
x := 10; (* we change values of
x & y *)
y := 7;
END Do;
VAR
a, b:
CARDINAL;
(* variable-declarations *)
BEGIN
WrLn;
(* a & b get initiial values *)
a := 1;
b := 2;
WrStr("Values BEFORE Do procedure:");WrLn;
WrStr(" a = ");WrCard(a, 0);WrLn;
WrStr(" b = ");WrCard(b, 0);WrLn;
Do(a, b);
WrStr("Values AFTER Do procedure:");WrLn;
WrStr(" a = ");WrCard(a, 0);WrLn;
WrStr(" b = ");WrCard(b, 0);WrLn;
END D1.