TO
The part of the FOR … TO … STEP statement which introduces the terminating value for the loop. When the loop control variable exceeds the value following ‘TO’ the loop is terminated. For example,
10 FOR i=1 TO 5 STEP 1.5
20 PRINT i
30 NEXT
40 PRINT "**********"
50 PRINT iwill print
1
2.5
4
**********
5.5Irrespective of the initial value of the loop control variable and the specified terminating value, the loop will execute at least once. For example,
10 FOR i= 20 TO 10
20 PRINT i
30 NEXTwill print
20
Syntax
FOR <n-var>=<numeric> TO <numeric> [STEP <numeric>]Associated Keywords
FOR, NEXT, STEP
Last updated on