[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
SUB...END SUB Define Procedure
SUB identifier [(parmlist)]
[LOCAL varlist]
[STATIC varlist]
[SHARED varlist]
.
. [statements]
.
[EXIT SUB]
END SUB
Defines a procedure (subprogram).
identifier A name for the procedure; must be unique and must follow
conventions for naming labels and variables.
parmlist A comma-delimited list of formal parameters to be passed
when the procedure is CALLed. The parameter's names serve
only to define the procedure; they have no relationship to
like-named variables elsewhere in the program.
varlist A comma-delimited list of variables declared LOCAL,
STATIC, or SHARED.
EXIT SUB An optional early exit point from the procedure. Does not
terminate the procedure definition (END SUB is still
required).
--------------------------------------------------------------------------
Notes: Procedures may be defined anywhere in a source program.
Execution flow does not need to be directed through (or
around) the procedure definition.
Do not jump into or out of a procedure definition with
GOTO, GOSUB, or RETURN.
Array names in parmlist should be followed by a number in
parentheses, specifying the number of dimensions in the
array.
Procedure variables are SHARED (global) by default.
Borland recommends that you declare SHARED variables
explicitly, however, in case the default is changed in
future versions of Turbo Basic.
See "SUB..INLINE" for defining assembly language
procedures.
See Also:
CALL
EXIT
LOCAL
SHARED
STATIC
SUB...INLINE
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson