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.
END Statement Details
  Syntax  Details  Example                 Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
END stops a BASIC program, procedure, or block.
 
END [{DEF | FUNCTION | IF | SELECT | SUB | TYPE}]
END [n%]
    ■ The value n% can be used by DOS or OS/2 batch files or by
      non-BASIC programs. Untrapped errors and fatal errors set the value
      of n% to -1.
 
Usage Notes
    ■ By itself, END stops program execution and closes all files. In a
      stand-alone program, END returns control to the operating system;
      in the QBX environment, END returns to the environment.
    ■ The following table shows where END is required:
 
        Location                                        Required?
        ═══════════════════════════════════════════     ═════════ 
        End of a program                                No
        End of multiline DEF FN function definition     Yes
        End of a FUNCTION procedure definition          Yes
        End of a block IF...THEN...ELSE statement       Yes
        End of a SELECT CASE block                      Yes
        End of a BASIC SUB procedure                    Yes
        End of a user-defined type definition (TYPE)    Yes
 
    ■ You can place END statements anywhere in the program to terminate
      execution.