i have a general case of representing an int in a for loop.
i have some variables(it doesnt really matter) which are instance of menuItem(cocos2d) and the got numbers like this:
w1,w2,w3,w4...
and for the record each one of them is pointer to :
CCMenuItemImage *w1= .....
and they have this property: w1.tag=1 w2.tag=2...
now my basic issue is to run on a loop on this w’s as follow :
for(int i=0;i<10;i++)
{
if ( w%i.tag <5 )
//do here
}
now i am trying to find a way to present the number coming after the w with my index!
its easy with nsstrings BUT what if i need anything else that has a number after it ?
thanks lot.
Naming variables using sequential numbers is almost always a sign that you should be using an array instead.
If you ever have homogeneous objects that differ only by their position in a sequence, then you need an array.