I'm trying to alter the boundaries of a loop using a compound variable (ie if condition is met move the end of an entry to another line). Hopefully the code illustrates better what I'm trying to accomplish:
Do i = entry.enum.start to entry.enum.stop
Say "Ln# :"i
If i = 5 Then entry.enum.stop = 10
End i
Output is:
Ln# :4
Ln# :5
Ln# :6
....instead of all the way to Ln# :10
So my question would be, is it possible to alter the loop inside when a condition is met or is the boundaries given will be the boundaries committed to?
the logic behind is a bit odd, but....
the answer is nooo
the do loop boundaries are computed at do loop initialization
( You can check by running with TRACE "I" )
the only whay ( I tested ) is with a while
Code:
start = 4
end = 6
i = start
do while ( i <= end )
say "i " i
if i = 5 then end = 10
i = i + 1
end