get_players
v1
PHP Code:
PHP Code:
|
Re: get_players
Obviously the second one. You don't need to check anything if you execute the same code for all cases.
|
Re: get_players
PHP Code:
PHP Code:
|
Re: get_players
Connor, all "for" cicles must be started like that
v1 PHP Code:
At the moment when i use for cicle so i do it like that v2 PHP Code:
|
Re: get_players
Connor already posted the most efficient one, why do you keep trying to use different version?
Quote:
|
Re: get_players
Quote:
counter; condition; increment you DO NOT need to define the counter in the header. The condition doesn't have to be related to the counter, and the increment is just a way of manipulating the data after the iteration. It is used most commonly as you have discribed, but it can be done in many different ways. It is pretty much a glorified while loop, with a counter. Use connor's code. it relieves a native call, 3 variables, and is actually more easy to understand. This is because instead of filling an array, then starting from zero at that array and working to the end. it fills the array, takes the count of that array, and works from the top down. Also, you don't need to add your tid = players[i] because you're only calling players once. This is just redundant in this manner. You should only use that statement when you're going to be indexing an array more than once in your loop. EDIT: but to answer your question....v2 would be the best way OF THOSE SELECTIONS. This is because num will ALWAYS be <= maxPlayers, because its the number if ids indexed into the players array. |
Re: get_players
YamiKaitou - just trying to find out that's the different between "this" or "that" code.
|
Re: get_players
Quote:
|
| All times are GMT -4. The time now is 15:06. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.