summaryrefslogblamecommitdiff
path: root/misc/pascal/tests/src/007-function.pas
blob: 0738db9890fa3f740f8e72134bb4261bdbb82a4c (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                                     
{ a simple nested function }

program simplefunc(output);

function addmul(term1a, term1b, term2a, term2b: integer ) : integer;
   function factor(terma, termb: integer ) : integer;
   begin
      factor := terma + termb;
   end;
begin
   addmul := factor(term1a, term1b) + factor(term2a, term2b);
end;

begin
  writeln('(1 + 2) * (3 + 4) =', addmul(1, 2, 3, 4));
end.