In C++ there is a continue; instruction that we can use in a loop to return to the beginning of a loop. i just want to know if there's something similar in VB6.
Thanks guy
Printable View
In C++ there is a continue; instruction that we can use in a loop to return to the beginning of a loop. i just want to know if there's something similar in VB6.
Thanks guy
No. There isn't any. All you can use is a Label and GoTo.
VB Code:
Private Sub MySub() Do Until [Condition1] = False If [Condition2] = True Then 'Do some stuff GoTo Continue End If ' Do some other stuff If [Condition3] = False Then Exit Do ' ' Rest of the code ' Continue: Loop End Sub
I'm sorry but IMO using lables like that is a bad programming practice and if you ever think you need to use a label you should rethink the code. For example in your example wouldn't the loop end when you went back to the top because [Condition] is True? And if that's the case then Exit Do would be the thing to use rather than the Go To.Quote:
Originally Posted by iPrank
Oh. Sorry. Edited the psudo code.
And yes, you are right. Using Labels/GoTo not good a practice. :)