Number program lines – Rockwell Automation 1771-DB BASIC MODULE User Manual

Page 70

Advertising
background image

Chapter
Programming the BASIC Module

4

4 -6

BASIC program lines always begin with a line number ranging from 0 to
65535. The line numbers indicate the order in which the program lines are
stored in memory. You also use them as references when branching and
editing. Typically you start numbering BASIC programs with line number
10 and increment by 10. This allows you to add additional lines later as
you work on your program. You can use a line number only once in a
program. Each line can contain no more than 79 characters.

Since the computer runs the statements in numerical order, additional lines
need not appear in consecutive order on the screen. For example, if you
enter line 35 after line 40, the computer still runs line 35 after line 30 and
before line 40. This technique saves you from re-entering an entire
program if you forget to include a line.

Important: If you reuse an existing line number all information you
referenced with original line number is lost. Be careful when entering line
numbers in Command mode, you may accidentally erase program lines.

After the line number, you may have a combination of BASIC statements
(Chapter 11), operators (Chapter 9), or CALLs (Chapters 12 and 13).
Depending on the logic of your program, you may have more than one
statement on a line. If so, you must separate each statement with a
colon (:).

The BASIC line must contain at least one character after the line number,
but no more than 79 characters, including the line number.

Number Program Lines

Chapter

Advertising