Inside Delphi 2006 (Wordware Delphi Developers Library)
Overview
Procedures and functions represent the most important material that you have to master before you can call yourself a programmer. Object-oriented programming, and Delphi programming in general, relies heavily on procedures and functions.
We have already used procedures in previous chapters, two of them very frequently: ReadLn and WriteLn. Every procedure or function is essentially a group of statements that hide behind a common name. For instance, the ReadLn procedure is made up of a number of statements that ask the user to enter a value and then transfer that value to a variable.
Procedures and functions are extremely useful because they enable us to write a piece of code once and then reuse it as many times as we need to. For example, Borland developers created the WriteLn procedure for displaying text in the console window, so now we don't have to rewrite the code for displaying text, but simply call the WriteLn procedure.
This chapter shows how to use existing procedures and functions and how to create new ones. You'll also read about several advanced topics related to procedures and functions, such as overloading and inlining.
The chapter ends with a description of how to create procedures and functions using the C++ language.