K
Krish
Hello,
This is an issue that I have encountered several times but have just
used a workaround to solve.
What is the accepted practice for breaking out of nested loops?
For example:
while( ... )
{
for( ... )
{
...
break;
}
}
When some condition is satisfied, how do you break out of the for and
the while loop (or however many nested loops you happen to have)?
Until now, I have just used a goto in place of the break statement to
jump to a label outside of the nested loops but this somehow doesn't
seem like good coding practice to me.
Thanks!
Krish
This is an issue that I have encountered several times but have just
used a workaround to solve.
What is the accepted practice for breaking out of nested loops?
For example:
while( ... )
{
for( ... )
{
...
break;
}
}
When some condition is satisfied, how do you break out of the for and
the while loop (or however many nested loops you happen to have)?
Until now, I have just used a goto in place of the break statement to
jump to a label outside of the nested loops but this somehow doesn't
seem like good coding practice to me.
Thanks!
Krish