Quick start manual

Programs and units
3-3
Unit structure and syntax
statements are simply method calls to the project’s Application object (most projects
have an Application variable that holds an instance of TApplication, TWebApplication,
or TServiceApplication). The block can also contain declarations of constants, types,
variables, procedures, and functions; these declarations must precede the statement
part of the block.
Unit structure and syntax
A unit consists of types (including classes), constants, variables, and routines
(functions and procedures). Each unit is defined in its own unit (.pas) file.
A unit file begins with a unit heading, which is followed by the interface,
implementation, initialization, and finalization sections. The initialization and
finalization sections are optional. A skeleton unit file looks like this:
unit Unit1;
interface
uses { List of units goes here }
{ Interface section goes here }
implementation
uses { List of units goes here }
{ Implementation section goes here }
initialization
{ Initialization section goes here }
finalization
{ Finalization section goes here }
end.
The unit must conclude with the word end followed by a period.
The unit heading
The unit heading specifies the unit’s name. It consists of the reserved word unit,
followed by a valid identifier, followed by a semicolon. For applications developed
using Borland tools, the identifier must match the unit file name. Thus, the unit
heading
unit MainForm;
would occur in a source file called MAINFORM.pas, and the file containing the
compiled unit would be MAINFORM.dcu or MAINFORM.dpu.