TSC AUTO ID Technology Co., Ltd. 130 Copyright 2013 All Rights Reserved.
FOR…NEXT LOOP
Description
Loop is used to execute one or more lines of program repetitively. A loop counter value specifies the
number of executions. Nested loops are allowed (up to 39 nested loops) in this printer. Jumping out in
the middle of the FOR…NEXT loop is prohibited.
Syntax
FOR variable = start TO end STEP increment
statement; start < end
[EXITFOR]
NEXT
The variable name is (up to 8 characters)
Integer or floating point numbers
Integer of floating point numbers
Integer or floating point, positive or negative
Example
Sample code
DOWNLOAD "TEST.BAS"
SIZE 4,2.5
GAP 0,0
CLS
FOR I=1 TO 10 STEP 1
TEXT 100,10+30*(I-1),"3",0,1,1,STR$(I)
NEXT
FOR I=1 TO 1000 STEP 100
TEXT 200,10+((I-1)/10)*3,"3",0,1,1,STR$(I)
NEXT
FOR I=110 TO 10 STEP -10
TEXT 300,10+(ABS(I-110))*3,"3",0,1,1,STR$(I)
NEXT
FOR I=1 TO 5 STEP 0.5
IF I-INT(I)=0 THEN Y=10+60*(I-1) ELSE Y=Y+30
TEXT 400,Y,"3",0,1,1,STR$(I)
NEXT
PRINT 1
EOP
TEST
See Also
DOWNLOAD, EOP