Extended Procedure and Function Features

Because procedures and functions are fairly universal topics as far as programming languages are concerned, we won't go into too much detail here. We just want to fill you in on a few unique or little-known features in this area. Where appropriate, we'll also point out the Delphi version in which various language features appeared to aid in porting or maintaining code compatible between various compiler versions.

Parentheses in Calls

Although it has been in the language since Delphi 2, one of the lesser-known features of Object Pascal is that parentheses are optional when calling a procedure or function that takes no parameters. Therefore, the following syntax examples are both valid:

 Form1.Show; Form1.Show(); ...

Get Borland® Delphi™ 6 Developer's Guide 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.