View Full Version : next iteration in loop
amateur1902
04-08-2008, 05:01 AM
Hello everyone,
Is there a way to go to the next iteration within a loop when it reaches a certain value?
Thanks
When what reaches a certain value?
amateur1902
04-08-2008, 05:13 AM
a = 0
Do While a < nr_comp + 1
base = vtresult(0, a, 0, 1) * 1.005
i = 0
Do While vtresult(i, a, 0, 1) <= base
t = vtresult(i, a, 0, 1)
If (i <= 15) Then
iGo = i - 1
Else
iGo = 3333
End If
i = i + 1
Loop
When i gets above 15 it needs to go to the next.
tstav
04-08-2008, 06:45 AM
Your code is not complete amateur1902 and your phrase is not complete
'When i gets above 15 it needs to go to the next what?'
Maybe you're referring to the code needing to jump to the outer Do...Loop but still, you leave us only guessing...
Try this but it is pure speculation of what you might mean to say...
a = 0
Do While a < nr_comp + 1
base = vtresult(0, a, 0, 1) * 1.005
i = 0
Do While vtresult(i, a, 0, 1) <= base
t = vtresult(i, a, 0, 1)
If (i <= 15) Then
iGo = i - 1
Else
iGo = 3333
Exit Do '<-- If by 'needs to go to the next' you mean 'go to the outer Do...Loop'
End If
i = i + 1
Loop
a = a + 1 '???? Something must be happening to variable a here I guess
Loop
amateur1902
04-10-2008, 12:45 AM
Hi Tstav,
Thanks for youre reply. Youre answer was 'speculative', but it made the code perfect:clap: . It now stops when i want to.
Thanks:bow: ,
Amateur
tstav
04-10-2008, 12:56 AM
Have a nice day ,
tstav :)
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.