huh? HUH!?
Printable View
huh? HUH!?
exit for
or
Exit While
Exit Do
You can also exit a function or sub with that keyword, so the complete list (according to the VB5 help) is:
VB Code:
Exit Do Exit For Exit Function Exit Property Exit Sub Exit While ' they forgot that
No I didn't :)Quote:
Originally posted by filburt1
VB Code:
Exit While ' they forgot that
I mean the VB5 help did. :)
Too bad, Exit While no longer works in VB6
Well use a Do While loop instead then.
Yes, I've always use DO WHILE loop, instead of WHILE WEND loop. Wondering, is there any difference other than the ability to exit loop.
Harddisk
The main difference is of course that you can put the While statement at the end of the loop and by doing that the loop will execute at least once.Quote:
Originally posted by Harddisk
Yes, I've always use DO WHILE loop, instead of WHILE WEND loop. Wondering, is there any difference other than the ability to exit loop.
Harddisk
Why would they kill the While-Wend loop? It's probably one of the most useful ones in any language. :confused:
filburt1, While Wend is still available, except that you are not able to exit/break from the loop halfway running it. :)Quote:
Originally posted by filburt1
Why would they kill the While-Wend loop? It's probably one of the most useful ones in any language. :confused:
The While ... Wend loop is actually sort of depricated. You can always use a Do While .... Loop iteration instead.Quote:
Originally posted by filburt1
Why would they kill the While-Wend loop? It's probably one of the most useful ones in any language. :confused:
BTW it has changed in VB.Net to While ... End While to be more like any other block statements in VB.
Best regards
But as pointed out the two loops have different purposes; even in C++ and Java there's:
So do both loops still exist in VB.Net?Code:do
{
} while (condition);
// and
while (condition)
{
}
Also yahs forgot the
Do Until
and
Loop Until
Example:
Do until a=5
Loop Until a=5
The difference is very small. If you use DO Until then the code will run one last time. If you use loop until it will stop looping immediately.
In VB you can use a Do loop for both cases.Quote:
Originally posted by filburt1
But as pointed out the two loops have different purposes; even in C++ and Java there's:
So do both loops still exist in VB.Net?Code:do
{
} while (condition);
// and
while (condition)
{
}
Both of these still exists in VB.Net. I as I already mentioned the other While loop still exists it just changed from WEnd to While End.VB Code:
Do While condition 'this is exactly like a While ... WEnd loop Loop 'or Do '... Loop While conditionDo Until is the exact same thing as Do While Not, it's just a preference of how you want to type it.VB Code:
'VB.Net code While condition '... End While
Best regards