Rice Lake iRite IDE User Manual

Page 24

Advertising
background image

20

920i

Programming Reference

'(' <arg-list> ')'

;

<arg-list>:

<optional-var-spec>

<variable-declaration>

| <arg-list> ';' <optional-var-spec>

<variable-declaration>

;

<optional-var-spec>:

/* 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-declaration>:

function IDENTIFIER

<optional-formal-args> ':' <type> ';'

<decl-section>

begin

<stmt-list>

end ';'

;

FUNCTION

IDENTIFIER

optional-formal-args

subprogram-completion

:

type

Figure 3-10. Function Declaration Syntax

Examples:

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

Advertising
This manual is related to the following products: