Clear – Rockwell Automation 1771-DB BASIC MODULE User Manual
Page 154

Chapter
Statements
11
11 -2
Use the CLEAR statement to set all variables equal to 0 and reset all
BASIC evoked interrupts and stacks. This means that after you execute the
CLEAR statement, you must execute an ONTIME statement (page 11 -25)
before the module acknowledges the internal timer interrupts. ERROR
trapping with the ONERR statement (page 11 -23) does not re-occur until
you execute an ONERR ln num statement.
The CLEAR statement does not affect the free running clock that is
enabled by the CLOCK1 statement (page 11 -5). CLOCK0 (page 11 -4)
is the only module statement that can disable the free running clock.
Nor does CLEAR reset the memory that has been allocated for strings, so
it is not necessary to re-enter the STRING expr, expr statement (page
11 -37) to re-allocate memory for strings after executing the CLEAR
statement. In general, use CLEAR to erase all variables.
You can also use CLEAR in Command mode.
Syntax
CLEAR
Example
>CLEAR
>LIST
1 REM EXAMPLE PROGRAM
10 DIM A(4)
20 DATA 10,20,30,40
30 FOR I=0 TO 3
40 READ A(I)
50 NEXT I
60 FOR J=O TO 3
70 PRINT A(J)
80 NEXT J
READY
>PRINT A(1),I,J
0 0 0
>RUN
10
20
30
40
READY
>PRINT A(1),I,J
20 4 4
>CLEAR
>PRINT A(1),I,J
0 0 0
CLEAR