for() vs foreach()
#2

I think it doesn't really matter. Even you do an itteration of 20000 you will probably only notice a difference of 1 or 2 milliseconds.

Correct me if I'm wrong, but basically doing

pawn Code:
foreach(Player, i)
{
    // Do something here if they're connected
}
is the same as

pawn Code:
for(new i; i < MAX_PLAYERS; i++)
{
    if(!IsPlayerConnected(i) || IsPlayerNPC(i)) continue;
    // Do something here if they're connected
}
Reply


Messages In This Thread
for() vs foreach() - by The Scripter - 20.08.2010, 22:04
Re: for() vs foreach() - by Vince - 20.08.2010, 22:29
Re: for() vs foreach() - by CaHbKo - 20.08.2010, 22:31
Re: for() vs foreach() - by Carlton - 20.08.2010, 22:56
Re: for() vs foreach() - by Nero_3D - 20.08.2010, 23:24
Re: for() vs foreach() - by The Scripter - 20.08.2010, 23:32
Re: for() vs foreach() - by [L3th4l] - 20.08.2010, 23:35
Re: for() vs foreach() - by Simon - 20.08.2010, 23:51
Re: for() vs foreach() - by The Scripter - 20.08.2010, 23:58
Re: for() vs foreach() - by lolumadd - 21.08.2010, 00:04

Forum Jump:


Users browsing this thread: 2 Guest(s)