215
Chapter 11: Programming Features
For variable, initial value, end value [, increment]
commands or multiple statements
Next
• Theincrementvaluecanbeomitted.Thedefaultvalueis1.
• ForandNextstatementsmustbeplacedatthebeginningofthe
line.
• Ifthecomparisonsvariable > end value (positive) or variable <
end value (negative) are satisfied, the program will end the loop
andgotothelineindicatedbytheNextcommand.
• Upto5Forloopscanbenested,thoughifcombinedwithother
types of loops, the maximum nested loop number may vary due
to the memory capacity.
• ItishighlyrecommendedthatLabelandGotostatementsarenot
usedinForloopstructures.
While conditional statements
commands or multiple statements
WEnd
• WhileandWEndstatementsmustbeplacedatthebeginningof
the line.
• MultipleWhileloopscanbenestedtowithinthememorycapacity.
• ConditionalstatementsareevaluatedbeforeenteringtheWhile
clause.
• ItishighlyrecommendedthatLabelandGotostatementsarenot
used in While loop structures.
• Upto8whileloopscanbenested,thoughifcombinedwithother
types of loops, the maximum nested loop number may vary due
to the memory capacity.
Note: Else clause cannot be omitted when the matching If clause is
containedinaFororaWhileloop.
Gosub label name
.....................
End
07 For
08 Next
09 While
10 WEnd
11 Gosub
12 Return