SA-MP Forums Archive
Use of "continue" properly? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Use of "continue" properly? (/showthread.php?tid=158673)



Use of "continue" properly? - MikkelGutten - 10.07.2010

I have a little problem with the use of "continue". I tried using the following code:
pawn Код:
if (!dini_Exists(File)) continue;
- It didn't turn out well. I looked at the SA-MP Wiki: https://sampwiki.blast.hk/wiki/Control_Structures#continue

As I understand "continue" can only be used in loops, and not in a simple function. Is that correct? If not how can I make the above code work?


Re: Use of "continue" properly? - Grim_ - 10.07.2010

While in a loop, "continue;" is used to skip to the next looped whatever it is. For example
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
   if(i == 5) continue;
   {
      //code here
   }
}
That will skip i when it equals 5. And not execute the code for it.


Re: Use of "continue" properly? - MikkelGutten - 10.07.2010

Quote:
Originally Posted by Grim_
Посмотреть сообщение
While in a loop, "continue;" is used to skip to the next looped whatever it is. For example
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
   if(i == 5) continue;
   {
      //code here
   }
}
That will skip i when it equals 5. And not execute the code for it.
Okay thanks alot,


Re: Use of "continue" properly? - Grim_ - 10.07.2010

You're welcome.