I have the following sample code:
How can I exit the loop if certain conditions are met. Normally you would use "Exit For" statement in For loop but it doesn't work here.
I know I could change the value of i to max. value when I get into the "If... end if" code but I need to know the value of i that stopped the For loop in the rest of the code?
I guess I could assign value of i inside "If ... end if" to another variable before changing it to max value but that complicates the code (unnecessary).
The same is with While loop
For i = 0 To 10
l = j(i)
if l > 20 then
'I want to exit the loop
end if
Next
How can I exit the loop if certain conditions are met. Normally you would use "Exit For" statement in For loop but it doesn't work here.
I know I could change the value of i to max. value when I get into the "If... end if" code but I need to know the value of i that stopped the For loop in the rest of the code?
I guess I could assign value of i inside "If ... end if" to another variable before changing it to max value but that complicates the code (unnecessary).
The same is with While loop