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
usesdeclaration. If so, theusesdeclaration 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
beginkeyword instead ofinitialization, but if you do, the unit cannot have afinalizationsection.
See Also
| Begin Keyword, End Keyword, Finalization Keyword, Implementation Keyword, Initialization Keyword, Interface Keyword, Uses Keyword |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access