Standard Pascal treats procedures and functions strictly as program parts that can be executed through procedure or function calls.
Borland Pascal has a much broader treatment of procedures and functions. Through procedural types, it allows procedures and functions to be treated as objects that can be assigned toand passed as .
A procedural-type declaration specifies parameters and, for a function, result type.
The syntax for a procedural-type declaration is identical to procedure or function header, except that it omits the identifier after the procedure or function keyword.
Proc = procedure;
SwapProc = procedure(var X, Y: Integer);
StrProc = procedure(S: string);
MathFunc = function(X: Real): Real;
DeviceFunc = function(var F: text): Integer;
MaxFunc = function(A, B: Real; F: MathFunc): Real;
Parameter names in a procedural-type declaration to not affect the meaning of the declaration.
Borland Pascal does not let you declare functions that return procedural-type values.
A function result value must be a, or a user-defined .