foreach vs for - 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: foreach vs for (
/showthread.php?tid=407587)
foreach vs for -
cotyzor - 14.01.2013
1.
for(new i = 0; i < MAX_PLAYERS; i++)
{
//bla bla
}
2.
foreach(Player, i)
{
//bla bla
}
1 or 2 ? Which is
faster ?
Re: foreach vs for -
Sweez - 14.01.2013
2.foreach !
Re: foreach vs for -
InfiniTy. - 14.01.2013
Foreach
Re: foreach vs for -
Diorturato - 14.01.2013
Foreach. More easy to working with arrays.
P.S. All poll-threads is typical post hunting for anyone.
Re: foreach vs for -
[KHK]Khalid - 14.01.2013
From Y-Less himself:
Quote:
Originally Posted by ******
foreach replaces some* loops (normally the main player loop) with a faster, more efficient loop.
|
Re: foreach vs for -
cotyzor - 14.01.2013
I recieve 3 answers, it seems foreach is fastest and best, close topic, thanks!