Описание тега delphi-units

Delphi units are source code modules (text files with .pas extension) that are compiled individually to form an application.

Delphi units are source code modules (text files with.pas extension) that are compiled individually to form an application. They are composed of four mandatory sections: header, interface, implementation, and closure; and by another two optional sections: initialization and finalization.

Example of the syntax of a unit:

unit UnitName; // Header section (mandatory)

interface // Interface section (mandatory)    
// Used to define required other units, constants, types, global variables, methods

implementation // Implementation section (mandatory)
// Implementation of the declared procedures and functions (methods)

initialization // Initialization section (optional)
// Sentences to be executed the first time that unit is referenced

finalization // Finalization section (optional)
// Sentences to cleanup allocated memory or freeing locked resources

end. // Closure section (mandatory)