SA-MP Forums Archive
continue in a double loop - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: continue in a double loop (/showthread.php?tid=643970)



continue in a double loop - Amads - 31.10.2017

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...


Re: continue in a double loop - 10MIN - 31.10.2017

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;
    } 



Re: continue in a double loop - OneDay - 31.10.2017

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



Re: continue in a double loop - Dayrion - 31.10.2017

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