Where
INDEX2-1 is the last entry into the array
TREES and we start with
TREES.ACTIVE from
0 to
INDEX2-1 all equal to
1.
for something_unrelated=0 to something_else
if one_parameter=true
for TINDEX=0 to INDEX2-1
if TREES(TINDEX).ACTIVE=1
TREES(TINDEX).ACTIVE=0
break
endif
next TINDEX
endif
next something_unrelated
The problem is that where it should find the first
1 in the array and replace it with
0, it locates them all and replaces them all with
0 because it never breaks from the loop. I know this to be true because when the main outer for-loop is run once and there are say, 150
TREES entries, all the
TREES().ACTIVEs are changed to
0.
This isn't the first place I've encountered this problem. But with this project it is more of a nuisance than where I first encountered it.
For the time being I have had to make do with a while-loop, which works, but I'm not very happy about using.
for something_unrelated=0 to something_else
if one_parameter=true
while TINDEX<INDEX2-1
inc TINDEX
if TREES(TINDEX).ACTIVE=1
TREES(TINDEX).ACTIVE=0
exit
endif
endwhile
endif
next something_unrelated