qbasic.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.
DEF FN Statement
  Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
Defines a function.
 
DEF FNname[(parameterlist)] = expression
DEF FNname[(parameterlist)]
    [statementblock]
  FNname = expression
    [statementblock]
  EXIT DEF]
    [statementblock]
  END DEF
 
    ■ parameterlist    One or more arguments in the following form:
 
                       variable[( )] [AS type] [, variable[( )] [AS type]]...
 
                       variable    A Basic variable name.
                       type        The data type of the variable (INTEGER,
                                   LONG, SINGLE, DOUBLE, STRING, or a
                                   user-defined data type).
 
    ■ expression       The return value of the function.
 
    ■ The FUNCTION statement provides a better way to define a function.
 
See Also    EXIT    FUNCTION    SHARED, STATIC