There are three cases, I don't know what you really want to do:
1. increment the outer loop, restart immediately the inner loop: use "break"
( from i=4, j=23 you'll have i=5,j=0 and the execution jumps to the
beggining of the inner loop)
2. increment the outer loop, reset the innner loop without restarting the
inner loop: use "i++; j=-1" ( from i=4, j=23 you'll have i=5,j=-1 the inner
loop continues with j=-1!!!; next on inner loop will be i=5; j=0)
3. increment the outer loop whitout restarting/resetting the inner loop:
"i++" ( from i=4, j=23 you'll have i=5,j=23 with continuation of the inner
loop; next on inner loop will be i=5; j=24)
--
Horatiu Ripa
"dawn" <da******@hotmail.com> wrote in message
news:9O**********************@phobos.telenet-ops.be...
Hi,
Once again I have a question :
In my app, I have nested loops, very basic stuff, like
for (int i = 0; i < 50; i++)
{
for (int j = 0 ; j < 75; j++)
{
if (expression)
{
do something
}
else
{
do something else
}
}
}
What I would like to do, is when I reach "do something else" move on to
the next step of the outer loop.
So i = 2 ; j = 24
I encounter "do something else"
now I want to move on to i = 3
How can I accomplish this?
Thanks