Next, Syntax, Example – Rockwell Automation 1771-DB BASIC MODULE User Manual

Page 173

Advertising
background image

Chapter
Statements

11

11 -21

Use the NEXT statement to return the FOR-TO-(STEP)-NEXT loop
(page 11 -11) to the beginning of the loop and add the value of the index
increment to the index. The current index value is then compared to the
index limit to determine if another loop should be performed.

Syntax

NEXT

Example

>1 REM EXAMPLE PROGRAM

>5 E=0 : C=10 : D=2

>10 FOR A=E TO C STEP D

>20 PRINT A

>30 NEXT A

>40 END

>RUN

0

2

4

6

8

10

READY

>

>NEW

>1 REM EXAMPLE PROGRAM

>10 FOR I = 0 TO 8 STEP 2

>20 PRINT I

>30 NEXT I

>40 END

>RUN

0

2

4

6

8

NEXT

Advertising