`prev Menu next`

Variable Parameter (Pass by Reference) ☆
When a variable is passed to a subprogram, the parameter is made to point to the same location in the memory as that of the argument.
Therefore, if the argument passed to a subprogram is a variable, when the parameter is changed, the argument also changes.
Example.

    100  DECLARE EXTERNAL SUB exchange
    110  LET a=1
    120  LET b=2
    130  CALL exchange(a,b)
    140  PRINT a,b
    150  END
    200  EXTERNAL SUB exchange(x,y)
    210  LET t=x
    220  LET x=y
    230  LET y=t
    240  END SUB

If you want the argument not to be changed, write it in parenthesis as follows.
`130 CALL exchange((a),(b))`
Note.
On function definitions, parameters are placed at different location of the arguments. Thus any function definition does not change arguments.