About Parameters

Most procedure and function headers include a parameter list. For example, in the header function Power(X: Real; Y: Integer): Real; the parameter list is (X: Real; Y: Integer).

A parameter list is a sequence of parameter declarations separated by semicolons and enclosed in parentheses. Each declaration is a comma-delimited series of parameter names, followed in most cases by a colon and a type identifier, and in some cases by the = symbol and a default value. Parameter names must be valid identifiers. Any declaration can be preceded by var, const, or out. Examples:

  • X, Y: Real)
  • var S: string; X: Integer)
  • HWnd: Integer; Text, Caption: PChar; Flags: Integer) (const P; I: Integer)

The parameter list specifies the number, order, and type of parameters that must be passed to the routine when it is called. If a routine does not take any parameters, omit the identifier list and the parentheses in its declaration:

procedure UpdateRecords; begin end;

Within the procedure or function body, the parameter names (X and y in the first example) can be used as local variables. Do not redeclare the parameter names in the local declarations section of the procedure or function body.

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