qb45advr.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.
CALL (BASIC Procedures) Statement Details
  QuickSCREEN      Details      Example      Contents      Index
──────────────────────────────────────────────────────────────────────────────
CALL (BASIC Procedures) Statement Details
 
Syntax
  CALL name[(argumentlist)]
 
  Argument      Description
  name          The name, limited to 40 characters, of the BASIC SUB
                being called. The name must appear in a SUB statement
                if the SUB is in the same module.
 
  argumentlist  The variables or constants passed to the subprogram.
                Arguments in the list are separated by commas.
                Arguments passed by reference can be changed by the
                subprogram.
 
If the argumentlist includes an array argument, the array is specified
by the array name followed by empty parentheses:
 
  DIM IntArray(1 TO 20)
  .
  .
  .
  CALL ShellSort(IntArray())
 
When you use the CALL statement, the CALL keyword is optional.
However, if you omit the CALL keyword, you must declare the procedure
in a DECLARE statement. Notice also that when you omit the CALL
keyword, you also omit the parentheses around the argument list.
 
Arguments are passed by reference: the subprogram is given the address
of the argument. This allows subprograms to change the argument values.
BASIC can also pass arguments by value. The following statement calls
a subprogram and passes a single argument by value:
 
  CALL SolvePuzzle((StartValue))
 
Because StartValue is in parentheses, BASIC evaluates it as an
expression. The result is stored in a temporary location, and the
address of the temporary location is passed to the SUB. Any change
made by the subprogram SolvePuzzle is made only to the temporary
location and not to the variable.