xref: /csrg-svn/old/dbx/tests/pc/nestedf.p (revision 44172)
1*44172Sbostic(*
2*44172Sbostic * Test of nested functions.
3*44172Sbostic *)
4*44172Sbostic
5*44172Sbosticprogram nested (input, output);
6*44172Sbosticvar
7*44172Sbostic    i, k : integer;
8*44172Sbostic
9*44172Sbosticfunction f (var i : integer) : integer;
10*44172Sbosticvar
11*44172Sbostic    j, k : integer;
12*44172Sbostic
13*44172Sbostic    function nestedf (var j : integer) : integer;
14*44172Sbostic    var
15*44172Sbostic	i : integer;
16*44172Sbostic    begin
17*44172Sbostic	i := j + 2;
18*44172Sbostic	j := i;
19*44172Sbostic	nestedf := j;
20*44172Sbostic    end;
21*44172Sbostic
22*44172Sbosticbegin
23*44172Sbostic    j := i + 1;
24*44172Sbostic    i := nestedf(j);
25*44172Sbostic    i := j;
26*44172Sbostic    f := i;
27*44172Sbosticend;
28*44172Sbostic
29*44172Sbosticbegin
30*44172Sbostic    i := 3;
31*44172Sbostic    i := f(i);
32*44172Sbosticend.
33