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
◄Summary► ◄Details► ◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
Defines and names a function.
Syntax 1:
DEF FNname[(parameterlist)] = expression
Syntax 2:
DEF FNname[(parameterlist)]
[statementblock]
FNname = expression
[statementblock]
[EXIT DEF]
[statementblock]
END DEF
■ parameterlist One or more arguments in the following form:
[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 Visual Basic variable name; for array
variables, empty parentheses are required
• type Data type of the variable: INTEGER, LONG,
SINGLE, DOUBLE, STRING, or a user-defined
data type
■ expression Return value of the function
■ EXIT DEF Immediately exits an executing DEF FN function
See Also
◄DEF FN Scope Rules► ◄DEF SEG Statement►
◄FUNCTION Statement► ◄SHARED Statement►
◄STATIC Statement►