continue in a double loop
#1

PHP Code:
    for(new i10i++)
    {
        for(new 
g25g++) if(vExample[g] == vArray[i]) continue;
    } 
I want to skip an iteration in the first loop (i), not the second one, in which continue is used (g).
Don't quite know how to achieve it...
Reply
#2

I think you should break second loop, and then continue the first, or the simpler: (reversed loops (code dependant) )
PHP Code:
    for(new i25i++)
    {
        for(new 
g10g++) if(vExample[i] == vArray[g]) continue;
    } 
Reply
#3

PHP Code:
    for(new i10i++)
    {
        for(new 
g25g++) if(vExample[g] == vArray[i]) goto continue_2;
continue_2:
    } 
Reply
#4

PHP Code:
for(new i10i++) 
    { 
        for(new 
g25g++)
            if(
vExample[g] == vArray[i])
                break; 
    } 
It will stop the second loop and skip an iteration in the first loop.
If you don't want re-loop the second iteration, your code have no-sence
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)