SUB

Top  Previous  Next

Syntax

SUB name(paramlist) { ,returntype }

Description

Begins a subroutine (function).

Parameters

name - Name of subroutine

paramlist - Comma separated list of parameters in the format of variable as type or variable:type.

returntype - Optional return type. Any built in type or UDT.

Return value

None

Remarks

Each SUB statement must be matched with an ENDSUB. You must use the RETURN statement whether or not you return a value. The return type is optional and can be omitted if you don't return a value.

See Also: DECLARE, ENDSUB, RETURN

Example usage

SUB mysub( a as INT, b as INT), INT
    RETURN a+b
ENDSUB