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.
Fundamental Building Blocks: Program Line
  Fundamental Building Blocks   Program Line   Contents   Index
──────────────────────────────────────────────────────────────────────────────
The BASIC Program Line
 
All BASIC program lines have the following syntax:
 
  [line-identifier][statement][:statement]...[comment]
 
Line identifier
A line in BASIC may have one line-identifier. BASIC supports two types of
line-identifiers (which may be used in the same program):
 
  ■ line numbers
       ■ Range 0 to 65,529
       ■ May begin in any column; must be first character in the line
 
       ■ line numbers (examples):
               200
               300 PRINT"hello"     '300 is the line number
 
       ■ line numbers (special notes):
            ■ Using 0 is not recommended since it has a special meaning to
              the ON ERROR, ON event, and RESUME statements.
 
            ■ Line numbers do not determine the order in which statements
              are executed in QuickBASIC. For example, QuickBASIC executes
              statements in the following program in the order 100, 10, 5:
 
                   100 PRINT "The first line executed."
                    10 PRINT "The second line executed."
                     5 PRINT "The third and final line executed."
 
              Some older BASICs, such as BASICA, would expect the lines
              to be in numerical order: 5, 10, 100.
 
  ■ alphanumeric line labels
       ■ 1 to 40 letters and digits.
       ■ Must start with a letter and end with a colon.
       ■ BASIC keywords are not permitted.
       ■ May begin in any column; must be first character in the line.
       ■ Case is not significant (alpha:, AlPHa:  and ALPHA: are equivalent
         line labels).
       ■ Blanks and tabs are allowed between the label and the colon.
 
       ■ alphanumeric line labels (examples):
               Alpha:
               ScreenSub:
 
       ■ alphanumeric line labels (special notes):
 
            ■  May not be used in IF...THEN statements, unless you use a
               GOTO statement:
 
                    IF A = 10 THEN 500     'correct use of line number
 
            ■  If the object of the IF...THEN statement is a line label, a
               GOTO statement is required:
 
                   IF A = 10 THEN GOTO IncomeData
 
BASIC Line Length
 
  ■ From within the QuickBASIC editor
     ■ QuickBASIC's built-in editor limits the length to 256 characters
     ■ The underscore character (_) cannot be used for line continuation
 
  ■ From within your own editor
     ■ You may use the underscore as the last character to create a program
       line, like the following, that extends across more than one physical
       line:
 
            IF (TestChar$ = " " OR TestChar$ = ".") AND LineNumber < 23 _
            AND NOT EOF(FileNumber) THEN
 
     ■ When QuickBASIC loads your program, the underscores are removed and
       the continued lines are joined to form a single line that may
       exceed 256 characters in length
 
     ■ Underscores cannot be used to continue DATA or REM statements