Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- QuickBASIC 3.0 - <b>sub...end sub define subprogram</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
SUB...END SUB            Define Subprogram

 SUB globalname [(parmlist)] STATIC
 .
 .
 .
 [EXIT SUB]
 .
 .
 .
 END SUB

    Defines a subprogram.

  globalname    A variable name of 31 or fewer characters. globalname may
                not appear in any other SUB statement in the same program
                or in the user library.

    parmlist    One or more simple variables or arrays passed as
                parameters when the subprogram is CALLed. Names of array
                variables must be followed by an integer enclosed in
                parentheses; the integer specifies the number of
                dimensions in the array. Parameters are passed by
                reference.

      STATIC    Indicates that the subprogram is nonrecursive. QuickBASIC
                3.0 does not support recursive subprograms, so the STATIC
                attribute is mandatory.

    EXIT SUB    Provides optional exit from within a subprogram.

   -----------------------------------------------------------------------

      Notes:    Variables used within subprograms are local unless
                declared otherwise by means of a SHARED statement.
                Nevertheless, when a subprogram is exited and later
                reentered, the value of a local variable may have changed.
                To guarantee that a variable's value will not change
                between subprogram CALLs, declare the variable STATIC by
                means of a STATIC statement (not to be confused with the
                STATIC attribute of the SUB statement).

                You may not enter or exit a subprogram by means of GOSUB,
                GOTO, or RETURN.

See Also: CALL SHARED STATIC

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson