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.
Passing Arguments
◄Procedures► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
Passing Arguments
Procedure Arguments If Variable If Expression
Type Passed By Argument Argument
FUNCTION Reference Can change variable Cannot change variable
SUB Reference Can change variable Cannot change variable
DEF FN Value Cannot change variable Cannot change variable
Passing by reference means that the address of each argument is passed
to the procedure by placing the address on the stack. Passing by value
means that the value of the argument, rather than the address, is passed
on the stack.
You can simulate a pass by value by using an expression in SUB call or
FUNCTION invocation:
Xcoordinate=Transform((A#))
Because (A#) is an expression, BASIC calculates its value, A#, and passes
the address of a temporary location containing the value. An address is
still passed, but because it is the address of a temporary location, the
action simulates a pass by value.