08-24-2023, 12:36 PM
I vaguely remember something about this at the old .com forum, but I forget the reason, so I thought I'd just ask about it here.
Why are variable used with FOR/NEXT +1 more at the end? I was doing a count using a FOR/NEXT variable and couldn't figure out why afterwards the variable end up +1 number higher when over.
In this example, the FOR/NEXT prints all 10 t's, but when printing the last t value over, it's at 11, and the FOR/NEXT never went to 11. Why is that?
- Dav
Why are variable used with FOR/NEXT +1 more at the end? I was doing a count using a FOR/NEXT variable and couldn't figure out why afterwards the variable end up +1 number higher when over.
In this example, the FOR/NEXT prints all 10 t's, but when printing the last t value over, it's at 11, and the FOR/NEXT never went to 11. Why is that?
- Dav
Code: (Select All)
'print 10 t's
For t = 1 To 10 'stop t at 10
Print t
Next
'so t is 10...but...
Print
Print
Print t 'this show 11 now?