12-01-2022, 04:51 PM
(11-30-2022, 07:49 PM)James D Jarvis Wrote: Why does this happen?
when this is the code?
Code: (Select All)Dim x
For x = 1 To .05 Step -.05
Print x
_Delay x
Next x
Is there a complier setting to keep this from happening?
The lesson is don't trust a single index in a FOR loop with < 1 steps. It gets off track by as much as half the step value.
Here is equivalent that works better:
Code: (Select All)
Dim x
For x = 100 To 5 Step -5
i = i + 1: Print i, x / 100
_Delay x / 100 ' <<< why ?? accuracy .001
Next x
b = b + ...