|
-
Dec 13th, 2004, 09:38 AM
#1
Exit Sub in C#?
I'm inside a for loop. How do I exit the for loop? And the sub?
-
Dec 13th, 2004, 09:54 AM
#2
Frenzied Member
Re: Exit Sub in C#?
Inside a loop, you use the break; statement. To exit a method, use return;
-
Dec 13th, 2004, 11:25 AM
#3
Banned
Re: Exit Sub in C#?
 Originally Posted by mendhak
I'm inside a for loop. How do I exit the for loop? And the sub?
C# = C++ when it comes to exiting.
Code:
for(int i = 0; i<10; i++)
{
if (!(i%2))
//divisible by 2
break; //break outter for
....
}
return; //get out of routine...although you should return some sort of status
-
Dec 13th, 2004, 11:17 PM
#4
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
|