|
-
Jun 5th, 2004, 09:05 PM
#1
Thread Starter
PowerPoster
Using the Exit statement, is this OK? (Resolved)
I've had to put a For Next loop inside a Do While loop:
VB Code:
Do While i < 24
' some code
For j As Byte = 0 To 10
' some more code
If Rand(j) >= 33 AndAlso Rand(j) <= 126 Then
If i = 24 Then Exit Do
End If
Next
Loop
Is it OK to exit the Do While loop from within the For Next loop like that, or is it going to leave stuff on the stack? As usual MSDN Library is as clear as mud on the matter
Last edited by SuperSparks; Jun 6th, 2004 at 12:49 PM.
Nick.
-
Jun 6th, 2004, 08:30 AM
#2
Frenzied Member
Never seen that. Don't know the correct answer, would seem it would be ok. Try it.
Of course, you could exit the For loop first. Probably safer.
-
Jun 6th, 2004, 09:13 AM
#3
There is no problem with the stack here.
It is perfectly acceptable to do that.
Unless you are doing something like opening streams, and exiting the do loop before you've closed them, you wouldn't be able to predict in what order the objects are GC'd. But thats just a common-sense call.
For general use its fine though.
I don't live here any more.
-
Jun 6th, 2004, 11:58 AM
#4
Thread Starter
PowerPoster
That's great. Thanks guys
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|