tnest3.pp 449 B

123456789101112131415161718192021222324252627282930313233
  1. {$mode objfpc}
  2. {$modeswitch nestedprocvars}
  3. type
  4. tnestedfunc = function (i: longint): longint is nested;
  5. function test: longint;
  6. var
  7. i: longint;
  8. function func3(aa: longint): longint;
  9. begin
  10. result:=i+aa;
  11. end;
  12. function func(aa: integer): integer;
  13. var
  14. nf: tnestedfunc;
  15. begin
  16. nf:=@func3;
  17. result:=nf(aa);
  18. end;
  19. begin
  20. i:=100;
  21. result:=func(10);
  22. end;
  23. begin
  24. if test <> 110 then
  25. halt(1);
  26. writeln('OK');
  27. end.