Keep in mind that "Step -1" is not subtraction. It ADDS -1 to the loop variable.
There is no number -1 for a byte, so -1 is replaced by the equivalent 255. The original example becomes
You can also get bizarre results with ordinary integers by using an inappropriate step size.
There is no number -1 for a byte, so -1 is replaced by the equivalent 255. The original example becomes
Local t:Byte For t=10 to 0 Step 255 ' used to be -1 Nextand the loop is never entered.
You can also get bizarre results with ordinary integers by using an inappropriate step size.
Local n:Int For n = 1 To 2000000000 Step 600000000 Print n NextHere the problem is that we step past the final value while wrapping around to negative numbers. The loop doesn't terminate until we land on a suitably large positive number.