tblock1.pp 333 B

12345678910111213141516171819202122232425262728293031
  1. { %target=darwin,iphonesim}
  2. {$modeswitch blocks}
  3. type
  4. tblock = procedure is block;
  5. procedure test(b: tblock);
  6. begin
  7. b;
  8. end;
  9. procedure proc;
  10. begin
  11. writeln('called as block');
  12. end;
  13. const
  14. bconst: tblock = @proc;
  15. var
  16. b: tblock;
  17. begin
  18. b:=@proc;
  19. b;
  20. test(@proc);
  21. test(b);
  22. bconst;
  23. test(bconst);
  24. end.