SA-MP Forums Archive
Using continue in two loops at the same time - 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: Using continue in two loops at the same time (/showthread.php?tid=315044)



Using continue in two loops at the same time - Jochemd - 01.02.2012

pawn Code:
for(new v = 0; v < MAX_VEHICLES; v ++)
        {
            for(new i = 0; i < MAX_PLAYERS; i ++)
            {
                if(GetPlayerVehicleID(i) == v) continue;
            }
        }
As you see I am using two loops here at the same time (don't say DON'T). Now if I use "continue" will it skip the current 'i' or will it skip the current 'v'?

I know I should use a stock for this, but just wondering - I try to evade using stocks if I just use this for one command.

Jochem


Re: Using continue in two loops at the same time - RyDeR` - 01.02.2012

It'll skip the current loop.


Re: Using continue in two loops at the same time - =WoR=Varth - 01.02.2012

Depend on where you put the continue.
If you put it inside i loop, then the current i will skipped.


Re: Using continue in two loops at the same time - Jochemd - 01.02.2012

All right, thanks.