SA-MP Forums Archive
Loop in a 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: Loop in a loop (/showthread.php?tid=390704)



Loop in a loop - wups - 07.11.2012

pawn Код:
for(...)
{
   while(...)
   {
        continue;
   }

}
Will the "continue" continue the while loop? How do I continue the for loop?


Re: Loop in a loop - Vince - 07.11.2012

Yes, a continue or break statement only affects the lowest enclosing loop (in your case the while). Depending on what you actually want to do, I suggest just breaking out of the while. But if you have any extra code after the while loop, but within the for loop, you have a problem.


Re: Loop in a loop - [KHK]Khalid - 07.11.2012

Maybe you can use GOTO?


Re: Loop in a loop - Babul - 08.11.2012

Quote:

How do I continue the for loop

Код:
break;
this concept looks dangerous...