Is there a way to perform a group conditional statement?
For example, I have a process which returns random numbers from an array (x) which I want to compare to the first 100 prime numbers.
Is there a function or method available by which I could do:
if (x in first_100_prime_numbers)
...
As Almo already said in a comment, many collection classes in Cocoa have a
containsObject:method that you can use for this purpose. Note that performingcontainsObject:on an array will probably be much slower (especially when the array is large) than on a set or hash table as the method has to iterate over every item in the array until it finds a match.