Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Defining and Calling BASIC Procedures
◄Programming Tasks► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
Statements Used to Define and Call BASIC Procedures
Task Statement Action
═════════════ ═══════════════ ═══════════════════════════════════════
Defining a FUNCTION Declares the name, the parameters, and
procedure the return type of a FUNCTION procedure.
SUB Declares the name and the parameters of
a SUB procedure.
Calling a CALL (BASIC) Transfers control to a BASIC SUB
procedure procedure. (The CALL keyword is
optional.)
Exiting from EXIT FUNCTION Causes an immediate exit from a
a procedure FUNCTION procedure.
EXIT SUB Causes an immediate exit from a
SUB procedure.
Declaring DECLARE (BASIC) Declares a BASIC FUNCTION or SUB
procedure procedure and, optionally, specifies
references to a the number and type of its parameters.
procedure
Sharing COMMON Shares variables among separate
variables modules. When used with the SHARED
among modules, attribute, it shares variables among
procedures, different procedures in the same
or programs module. Also, passes variable values
from current program to new program
when control is transferred with the
CHAIN statement.
SHARED Gives a SUB or FUNCTION procedure
access to variables declared at the
module level without passing them as
parameters.
Preserving STATIC Makes simple variables or arrays local
variable to a DEF FN function or a SUB or
values FUNCTION procedure, and preserves
values between calls.
Transferring CHAIN Transfers control from current
to another program in memory to another program;
program use COMMON to pass variables to the new
program.
RUN Restarts the program currently in memory,
or executes a specified program.