Toshiba KB-80 사용자 설명서

다운로드
페이지 79
- 30 -
Other FOR ~ NEXT statements can be used (nested) within the FOR ~ NEXT
statement.  In this case, each <variable> to be set should be different.  One FOR ~
NEXT statement should be completely included in the other FOR ~ NEXT statement.
Ex.)
<Proper>
<Wrong>
FOR I=1 TO 5
FOR I=1 TO 5
FOR J=1 TO 5
FOR J=1 TO 5
NEXT J
NEXT I
NEXT I
NEXT J
If FOR ~ NEXT statements are terminated at the same point, their NEXT statements
can be described in one statement as shown below.
Ex.)
FOR I=1 TO 10
FOR J=1 TO 10
FOR K=10 TO 1 STEP-1
NEXT K,J,I
When <variable> is omitted in the NEXT statement, the NEXT statement pairs off
with the nearest FOR statement.  If the NEXT statement is executed before the paired
FOR statement, a “NEXT Without FOR” error occurs.
<initial value> and <terminal value> are determined by the first FOR statement.
Ex.)
I=10
FOR I=I TO I+5
NEXT
A loop is performed within the range of “I = 10 to 15”.