about foreach
#1

Hello, I'm using most of the time the foreach include (I have the latest foreach/YSI library), and also I use iterators most of the time.

So.. I have 2 question:

1) What should I include foreach or y_iterate or both ?
Code:
#include <foreach>
or
#include <YSI\y_iterate>
2) How can I use both of the foreach syntax (old and the new/latest one) (is there a possible?)
foreach(Player, i)
foreach(new i : Player)

Sorry for my bad english..
Reply
#2

pawn Code:
foreach (new i : Player)
{
//Do your things.
}
Reply
#3

Quote:
Originally Posted by KinderClans
View Post
pawn Code:
foreach (new i : Player)
{
//Do your things.
}
I didn't correctly formulate the second question, I edited it. Sorry!
Reply
#4

1. If you're using iterators, as you've mentioned, you need to include y_iterate.
2. Why not stick to one syntax? Needless to say, stick to the syntax of the latest version.
Reply
#5

Quote:
Originally Posted by None1337
View Post
1) What should I include foreach or y_iterate or both ?
Code:
#include <foreach>
or
#include <YSI\y_iterate>
foreach has not been updated for a LONG time, stick with y_iterate.

Quote:
Originally Posted by None1337
View Post
2) How can I use both of the foreach syntax (old and the new/latest one) (is there a possible?)
foreach(Player, i)
foreach(new i : Player)

Sorry for my bad english..
There is a reason the old syntax declared as 'deprecated' -- avoid using it. Besides, if you use latest version of y_iterate will give a warning instead!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)