List, List -11, Purpose – Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual

Page 51: Syntax, Example

Advertising
background image

Publication 1746-RM001A-US-P

BASIC Commands 4-11

LIST

Purpose

Use the LIST command to print the program to the console device. Spaces are
inserted after the line number, and before and after statements. This helps in the
debugging of module programs. You can terminate the listing of a program at any
time by pressing

[CTRL-C]

on the console device. You can interrupt and continue

the listing using

[CTRL-S]

and

[CTRL-Q]

.

Syntax

LIST [ln num]

LIST [ln num] - [ln num]

The first variation causes the program to print from the designated line number [ln
num] to the end of the program. The second variation causes the program to print
from the first designated line number [ln num] to the second designated line
number [ln num].

Example

>LIST

1

REM EXAMPLE PROGRAM

10 PRINT “LOOP PROGRAM”

20 FOR I = 1 TO 3

30 PRINT I

40 NEXT I

50 END

READY

>LIST 30

1

REM EXAMPLE PROGRAM

30 PRINT I

40 NEXT I

50 END

READY

>LIST 20–40

1

REM EXAMPLE PROGRAM

20 FOR I = 1 TO 3

30 PRINT I

40 NEXT I

IMPORTANT

[CTRL–C]

terminates the listing if

[CTRL–C]

checking is

enabled.

[CTRL–S]

halts the listing until

[CTRL–Q]

is pressed if

software handshaking in enabled.

IMPORTANT

You must separate the two line numbers with a dash (–).

Advertising