Login
Register
Tutorials
Forum
Career Development
Resources
Reviews
Jobs
Interview
Communities
Projects
Training
Silverlight Games
|
Bookmarks
|
New Members FAQ
|
Mentor
|
Code Converter
|
IT Companies
|
Peer Appraisal
|
Members
|
Revenue Sharing
|
Computer Jokes
|
New Posts
|
Social
|
Talk to Webmaster Tony John
Online Members
Pawan Awasthi
More...
Forums
»
.NET
»
General
»
break
Posted Date:
01 May 2008
Posted By::
akku
Member Level:
Silver
Member Rank:
2716
Points
: 1
Responses:
4
ihave more than two loops in one function.. I have to exit from entire loop if one condition satisfies in the inner most loop.. Whats the Way
???????
Tweet
Responses
#223530 Author:
The Deep Blue Seas
Member Level:
Silver
Member Rank:
0
Date: 01/May/2008 Rating:
Points
: 2
Declare a boolean variable in the beginning and set its value to false as you move into the loops, when condition is true set bool to true.This will help you skip the rest of the loops and finally exit out of the function by calling break.
So typically your logic will be
if (!isExit)
{
for (...)
{
//set isExist to true or false here
}
}
#223580 Author:
Shivshanker Cheral
Member Level:
Gold
Member Rank:
26
Date: 02/May/2008 Rating:
Points
: 2
So typically your logic will be
if (!isExit)
{
for (...)
{
if (some condition)
{
//set isExist to true or false here
isExist = true;
break; // exit from inner loop
}
if (isExist)
{
break; // exit from outer loop
}
}
}
Thanks
Shivshanker Cheral
"If you share your assets (money etc..) it will decrease, But if you share your knowledge it will increase!!! ".
#223667 Author:
ChandraShekar Thota
Member Level:
Gold
Member Rank:
35
Date: 02/May/2008 Rating:
Points
: 2
Tell me in vb or c# so that i can give you code
Free Online,Offline Sessions
www.hyderabadtechies.info
chandrashekarthota@gmail.com /92 93 95 95 39
FREE SESSIONS ON .NET AND VISUALSTUDIO
#224327 Author:
kunal badgujar
Member Level:
Gold
Member Rank:
0
Date: 02/May/2008 Rating:
Points
: 2
hi..
if (!isexit)
{
for ()
{
if (Isexit==true)
{
break;
}
}
}
Post Reply
This thread is locked for new responses. Please post your comments and questions as a
separate thread
.
If required, refer to the URL of this page in your
new post
.
Tweet
Next :
Failures
Previous :
is it articles are removed.
Return to Discussion Forum
Post New Message
Category:
Related Messages
Diff In Oracle Error Displaying Messages.
Software requiremernt specification
About Subreports in crystal reports
PHP - urgent pls help
Crystal Report Problem
Follow us on Twitter:
https://twitter.com/dotnetspider
Active Members
Today
Pawan Awasthi
(68)
Phagu Mahato
(10)
Raj.Trivedi
(9)
Last 7 Days
baskar
(298)
Pawan Awasthi
(178)
Asheej T K
(173)
more...
Awards & Gifts
Email subscription
.NET Jobs
.NET Articles
.NET Forums
Articles Rss Feeds
Forum Rss Feeds