
FOR…NEXT LOOP
Description
Loop is used to execute one or more lines of program repetitively. Before anything,
a value should be assigned the loop counter to specify the execution times. Nested
loop is allowed (up to 39 nested loops) in this printer. Jumping out in the middle of
the FOR…NEXT loop is prohibited because it is not a good programming skill .
Syntax
For variable = start TO end STEP increment
statement; start < end
NEXT
Parameter
Description
variable
The variable name is up to 8 characters
start
Can be integer or floating point numbers
end
Can be integer of floating point numbers
increment
nteger or floating point, positive or negative.
Example
DOWNLOAD "LOOP.BAS"
SIZE 3,3
GAP 0.08,0
DENSITY 8
SPEED 4
DIRECTION 1
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
LOOP
See Also
DOWNLOAD, EOP