bas7advr.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 Statement (BASIC Procedures) Details
  Syntax  Details  Example                 Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
This CALL statement transfers control to a BASIC SUB procedure. A different
CALL statement is used to transfer control to a procedure written in
another language.
 
CALL name [([BYVAL] argument, [BYVAL] argument ...)]
  or
name [([BYVAL] argument, [BYVAL] argument ...)]
    ■ The argument name is limited to 40 characters.
    ■ BYVAL specifies that the argument is passed by value, rather
      than by reference. This keyword is informational in the CALL
      statement. For more information, see Usage Notes.
    ■ If you omit the optional CALL keyword, you must declare the
      procedure in a DECLARE statement and omit the parentheses around
      the list of arguments.
 
Usage Notes
    ■ If the argument list includes an array argument, the array is
      specified by the array name followed by empty parentheses:
 
        DIM IntArray(1 TO 20)
        .
        .
        .
        CALL ShellSort(IntArray())
 
    ■ The CALL statement passes arguments by reference or by value,
      depending on how the argument is defined in the DECLARE or SUB
      statements. Passing an argument by reference means that the
      procedure is given the address of the argument. This allows
      procedures to change the argument values. Passing an argument
      by value means that the procedure is given the value of the
      argument. This allows the argument to change locally in the
      procedure without affecting the value of the variable in the
      rest of the program.
    ■ Within the CALL statement, the BYVAL keyword is informational.
      An argument must be defined as being passed by value in the
      procedure or in the DECLARE statement for the procedure in
      order to pass that argument by value. For example:
 
        DECLARE SUB Mult(BYVAL X!, Y!)
        .
        .
        .
        CALL Mult (BYVAL X!, Y!)
 
      In this example, the BYVAL in the CALL statement is optional.
      Deleting it has no effect. Adding BYVAL to Y! in the CALL statement
      without changing the DECLARE statement would generate an error.
    ■ If you omit the optional CALL keyword, you cannot follow the
      procedure name with a colon (:), the BASIC statement separation
      character. If you do, BASIC will treat the procedure name
      as a label instead of as a call to the procedure.