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 source (.pas) file.

A unit file begins with a unit heading, which is followed by the interface keyword. Following the interface keyword, the uses clause specifies a list of unit dependencies. Next comes the implementation section, followed by the optional initialization, and finalization sections. A skeleton unit source file looks like this:

unit Unit1; interface uses // List of unit dependencies goes here... implementation uses // List of unit dependencies goes here...

  • Implementation of class methods, procedures, and functions goes here... initialization
  • Unit initialization code goes here... finalization
  • Unit finalization code goes here...

end.

The unit must conclude with the reserved word end followed by a period.

Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook


Post a comment