I have a mutable array of Boolean values and I want to check to see if ANY of the values are YES.
At present I am creating another array alongside this one which is always ALL False like so;
[MyArray addObject:[NSNumber numberWithBool:switchInput]];
[MyAllNoArray addObject:[NSNumber numberWithBool:NO]];
The user does some bits and the some of the objects in MyArray may become YES, I then use the below to see if ANY are true or not.
if([MyArray isEqualToArray:MyAllNoArray])
I am just wondering if there is a better way (this way seems wasteful)?
I have thought about a counter, each time one of the objects changes the counter goes up or down (depending on changing to YES or NO), if the counter is 0 then so is the array. But I am just thinking there may be a better way within an IF statement that I am missing.