beautypg.com

Rice Lake iRite IDE User Manual

Page 24

background image

20

920i

Programming Reference

'(' ')'

;

:

| ';'

;

:

/* NULL */

| var

;

PROCEDURE

IDENTIFIER

optional-formal-args

subprogram-completion

Figure 3-9. Procedure Declaration Syntax

Examples:

procedure PrintString (S : String);

begin

Writeln (1, "The String is => ",S);

end;

procedure ShowVersion;

begin

DisplayStatus ("Version 1.42");

end;

procedure Inc (var iVariable : Integer);

begin

iVariable := iVariable + 1;

end;

Function Declarations

A function declaration defines a subprogram that can be invoked by other subprograms. A function allows
parameters and requires a return type. A function must be declared before it can be referenced; recursion is not
supported. A function must return to the point of call using a return-with-value statement.

:

function IDENTIFIER

':' ';'

begin

end ';'

;

FUNCTION

IDENTIFIER

optional-formal-args

subprogram-completion

:

type

Figure 3-10. Function Declaration Syntax

Examples:

function Sum (A : integer; B : integer) : Integer;

This manual is related to the following products: