Name
Unit Keyword
Syntax
unitName
; interfaceDeclarations
... implementationDeclarations
... initializationStatements
... finalizationStatements
... end. unitName
; interfaceDeclarations
... implementationDeclarations
... beginStatements
... end.
Description
The unit
keyword introduces a unit, which is
Delphi’s basic module for building programs. A unit’s
name must match the filename (with a .pas
extension). Chapter 2 has more information about
units.
Tips and Tricks
The interface or implementation sections can each have a
uses
declaration. If so, theuses
declaration must appear first in the section.The initialization and finalization sections are optional. If a unit has a finalization section, it must have an initialization section, even if the initialization section is empty.
You can use the
begin
keyword instead ofinitialization
, but if you do, the unit cannot have afinalization
section.
See Also
Begin Keyword, End Keyword, Finalization Keyword, Implementation Keyword, Initialization Keyword, Interface Keyword, Uses Keyword |
Get Delphi in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.