Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Modifying a counted DO loop's counter?

May
12,949
171
The help says a counter DO loop sets an environment variable to the value of it's counter. Maybe so, but it doesn't use the current value of that environment variable when iterating. Below I'd expect to see just 1. But
Code:
v:\> type dotest.btm
do i=1 to 3
        echo %i
        set i=%@eval[%i+10]
enddo

v:\> dotest.btm
1
2
3

It would be quite useful to be able to jump ahead (maybe even backward) in a counted DO loop.
 
WAD; and it's always worked this way.

Each time through the loop, the counter is reset to the previous value + or - the increment / decrement value.

IMO, if you want to randomly change the counter you're using the wrong DO syntax - you should be doing a DO UNTIL or DO WHILE.
 

Similar threads

Back
Top