qck.hlp (Table of Contents; 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.
SUB Statement
  Summary  Details  Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
 Declares the name, arguments, and code that form the body of a SUB
 procedure.
 
    [STATIC] SUB globalname [(parameterlist)]
         [statementblock]
         [EXIT SUB]
         [statementblock]
    END SUB
 
    ■ STATIC           Indicates that the SUB procedure's local variables
                       are preserved between calls; does not affect variables
                       declared outside the procedure, even if they are used
                       in the SUB
 
    ■ globalname       Name of the SUB; a variable name up to 40 characters
                       long that cannot appear in any other SUB or FUNCTION
                       statement in the same project
 
    ■ parameterlist    List of variables, representing arguments, that are
                       passed to the SUB when it is called:
 
      [BYVAL] variable[( )] [AS type] [, [BYVAL] variable[( )] [AS type]]...
 
                       • BYVAL     Indicates the parameter is passed by value
                                   rather than by reference; cannot be used
                                   with a variable of a user-defined type
 
                       • variable  Name of variable to pass as an argument;
                                   for array variables, empty parentheses are
                                   required
 
                       • AS type   Data type of the variable: INTEGER, LONG,
                                   SINGLE, DOUBLE, STRING, CURRENCY, user-
                                   defined type, or two additional types,
                                   FORM and CONTROL
 
    ■ statementblock   Any group of statements to execute within the body
                       of the SUB procedure
 
    ■ EXIT SUB         Causes an immediate exit from a SUB procedure;
                       execution continues with the statement after the
                       statement that called the SUB; a SUB may have
                       multiple EXIT SUB statements
 
 See Also
    CALL Statement (Basic Procedures)     DECLARE Statement
    FUNCTION Statement