Restore, Rem tip restore – Rockwell Automation 1771-DB BASIC MODULE User Manual

Page 184

Advertising
background image

Chapter
Statements

11

11 -32

Use the REM command to specify a comment line in a BASIC program.
Adding comment lines to a program makes the program easier to
understand. Program lines that start with a REM command cannot be
terminated with a colon (:). REM commands can be placed after a colon
(:) in a program line. This allows you to place a comment on each line.

Important: REM commands add time to program execution. Use them
selectively or place them at the end of the program where they do not
affect program execution speed. Using REM commands in frequently
called loops or subroutines slows the BASIC program execution.

After debugging the program save a fully commented copy on disk and
remove comments from the executable program. PBASE provides a BDL
Macro that automatically strips comments from a program.

Syntax

REM

Example

>10 REM THIS IS A COMMENT LINE

>20 X=5 : REM THIS IS ALSO A COMMENT LINE

Use the RESTORE statement to reset the internal read pointer to the
beginning of the data so that you may read it again.

See also the DATA (page 11 -6) and READ (page 11 -31) statements.

Syntax

RESTORE

Example

>1 REM EXAMPLE PROGRAM

>10 FOR I = 1 TO 3

>20 READ A,C

>30 PRINT A,C

>40 NEXT I

>50 RESTORE

>60 READ A,C

>70 PRINT A,C

>80 DATA 10,20,10/2,20/2,SIN(PI),COS(PI)

READY

>RUN

10

20

5

10

0

–1

10

20

REM

Tip

RESTORE

Advertising