Are there times when you count, in a different way besides upwards by ones?
Yes--sometimes you count upwards by twos, sometimes you count down by ones, and so on.
Counting loops are very common,
and there are many ways to count.
The FOR
loop can do
more than count upwards by ones.
Here is a program that counts down from 5 to 1.
' FOR COUNTER = 5 TO 1 STEP -1 PRINT "Counter:", COUNTER NEXT COUNTER ' END
This program prints:
Counter: 5 Counter: 4 Counter: 3 Counter: 2 Counter: 1
What do you think that STEP -1
means
in the above program?