-- Demonstrates parameter mode errors
-- Modes represent a contract
procedure mode_error is
-- In mode parameters are constants
-- Out mode parameters are uninitialized on entering the procedure:
-- Out mode parameters must be given a value
procedure foo1(i: in Integer; o, p: out Integer) is
j: Integer := o + 1; -- compiles, but erroneous
begin
-- i := 3; -- error
null;
end foo1;
-- Out mode parameters must have variables as actual parameters
-- See the calls in foo5
procedure foo4(o: out Integer) is
begin
o := 3;
end foo4;
procedure foo5(i: in Integer) is
c: constant Integer := 5;
v: Integer;
begin
foo4(v); -- okay
-- foo4(2); -- compilation error
-- foo4(c); -- compilation error
-- foo4(i); -- compilation error
end foo5;
begin
null;
end mode_error;