qck.hlp (Table of Contents; Topic list)
FUNCTION Statement
  Summary  Details  Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
 Declares the name, arguments, code, and return type of a FUNCTION procedure.
 
    [STATIC] FUNCTION globalname ([parameterlist]) [AS type]
         [statementblock]
         globalname = expression
         [EXIT FUNCTION]
         [statementblock]
         globalname = expression
    END FUNCTION
 
    ■ STATIC           Indicates that the procedure's local variables are
                       preserved between calls; does not affect variables
                       declared outside the procedure, even if they are used
                       in the FUNCTION procedure
 
    ■ globalname       Name of the function; procedure names follow the same
                       rules for naming Visual Basic variables; can end with a
                       type-declaration character (%, &, !, #, @, or $)
 
    ■ parameterlist    List of variables that specify parameters passed to
                       the procedure 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, or user-
                                   defined data type
 
    ■ AS type          Keyword used when declaring the data type of the value
                       returned by FUNCTION; may be INTEGER, LONG, SINGLE,
                       DOUBLE, CURRENCY, or STRING
 
    ■ statementblock   Any group of statements that executes within the
                       body of the FUNCTION procedure
 
    ■ expression       Return value of the function; a FUNCTION procedure
                       returns a value by assigning that value to the
                       function name
 
    ■ EXIT FUNCTION    Causes an immediate exit from a FUNCTION procedure;
                       execution continues with the statement after the
                       statement that called the FUNCTION; a FUNCTION may
                       have multiple EXIT FUNCTION statements
 See Also
    CALL Statement (Basic Procedures)     DECLARE Statement
    SUB Statement