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>def fn define function</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
DEF FN                   Define Function

 1. DEF FNname[(parmlist)] = expression

 2. DEF FNname[(parmlist)]
    .
    . [statements]
    .
    [EXIT DEF]
    FNname = expression
    END DEF

    Defines a user function.

        name    A valid variable name, of the same type as expression.

    parmlist    One or more formal parameters for the function. Each must
                be a valid variable name. Parameters are passed by value.

  expression    An expression, of the same type as name, that defines the
                value returned by the function.

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

      Notes:    For numeric functions, the precision specified by name
                determines the precision returned by the function.

                Functions must be defined before they are called. They may
                not be defined within IF/THEN/ELSE, FOR/NEXT, WHILE/WEND,
                or SUB/END SUB blocks, and they may not be defined in
                terms of themselves.

                In the multi-line syntax, expression defines the value
                returned by the function. The optional EXIT DEF statement
                can be used to exit the function but does not define the
                end of the function.

                Variables in a multiline function definition are global
                unless declared in a STATIC statement.

See Also: STATIC

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