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--|------identifier---------
                            -qualified method identifier--
----formal parameter list|----------hintdirectives ----------------------
                     -modifiers -

--subroutine block-|-----block--------------------------------------
                |-external directive-|
                |---asm block----|

See section 14.4, page 687 for the list of parameters. 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);  
  Writeln (’Got parameter : ’,Para);  
  Writeln (’Parameter in upper case : ’,Upper(Para));  

Note that it is possible that a procedure calls itself.