14.1 Procedure declaration

A procedure declaration defines an identifier and associates it with a block of code. The procedure can then be called with a procedure statement.

_________________________________________________________________________________________________________
Procedure declaration

--procedure- declaration procedure-header- ;-subroutine- block-; -----------

 --procedure- header procedure- dotted- identifier-|------------
                                          <template- list>-
----formal- parameter- list|----------hint- directives---------------------
                     -modifiers -

--subroutine- block -|-----block--------------------------------------
                |-external- directive-|
                |---asm-block----|
                 ----forward------
____________________________________________

See section 14.4, page 785 for the list of parameters. Note that procedures can be generic, see section 8.5, page 494 for more details.

A procedure declaration that is followed by a block implements the action of the procedure in that block. The following is a valid procedure:

Procedure DoSomething (Para : String);
begin
  Writeln ('Got parameter : ',Para);
  Writeln ('Parameter in upper case : ',Upper(Para));
end;

As with most identifiers, a procedure can have hint directives (section 1.5, page 53):

procedure something; deprecated;

Note that it is possible that a procedure calls itself.