qb45advr.hlp (Topic list)
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.
Procedure-Building Statements
  Programming Tasks   Procedures   Contents   Index
──────────────────────────────────────────────────────────────────────────────
Statements Used to Define, Call and Share Data Between Procedures
 
Task              Statement                Action
 
Defining a        FUNCTION...END FUNCTION  Mark the beginning and end,
procedure                                  respectively, of a FUNCTION
                                           procedure
 
                  SUB...END SUB            Mark the beginning and end,
                                           respectively, of a SUB procedure
 
Calling a         CALL                     Transfers control to a BASIC
procedure                                  SUB procedure, or to a procedure
                                           written in another programming
                                           language and compiled separately.
                                           (The CALL keyword is optional.)
 
Exiting from      EXIT FUNCTION            Provides an alternative way to
a procedure                                exit a FUNCTION procedure
 
                  EXIT SUB                 Provides an alternative way to
                                           exit a SUB procedure
 
Referencing       DECLARE                  Declares a FUNCTION or SUB and,
a procedure                                optionally, specifies the number
before it is                               and type of its parameters
defined
 
Sharing           COMMON                   Shares variables among separate
variables                                  modules. When used with the
among modules,                             SHARED attribute, it shares
procedures,                                variables among different
or programs                                procedures in the same module.
                                           Also, passes variable values from
                                           current program to new program
                                           when control is transferred with
                                           the CHAIN statement.
 
                  SHARED                   When used with the COMMON, DIM,
                                           or REDIM statement summary
                                           statements at the module level
                                           (for example, DIM SHARED),
                                           shares variables with every
                                           SUB or FUNCTION in a single
                                           module.
                                           When used by itself within a
                                           procedure, shares variables
                                           between that procedure and
                                           the module-level code.
 
Preserving        STATIC                   Forces variables to be local
variable                                   to a procedure or DEF FN function
values                                     and preserves the value stored
                                           in the variable if the procedure
                                           or function is exited, then
                                           called again
 
Defining a        DEF FN...END DEF         Mark the beginning and end,
multiline                                  respectively, of a multiline
function                                   DEF FN function. (This is the
                                           old style for functions in
                                           BASIC - FUNCTION procedures
                                           provide a powerful alternative.)
 
Exiting from      EXIT DEF                 Provides an alternative way to
a multiline                                exit a multiline DEF FN function
function
 
Calling a         GOSUB                    Transfers control to a specific
BASIC                                      line in a module. Control is
subroutine                                 returned from the subroutine to
                                           the line following the GOSUB
                                           statement with a RETURN statement
                                           (This is the old style for
                                           subroutines in BASIC - SUB
                                           procedures provide a powerful
                                           alternative.)
 
Transferring      CHAIN                    Transfers control from current
to another                                 program in memory to another
program                                    program; use COMMON to pass
                                           variables to the new program