The Problem:Not being able to do a simple compare in an "if statement" between two alpha or numerical statements while programing in objective C.
The Solution:
NSOrderedSameExample Of Use:This compares the value of "key" to the value of "support." If they are equal then you get a return value of true.
if ([key compare:Support] == NSOrderedSame)
Explanation:For some reason Objective-C decided to make it a little bit harder to compare values. Instead of just using the traditional way "[key compare:Support]" return a true value for the if statement OR "([key compare:Support] == 0) OR "([key compare:Support] == true)" they decided to make it a little bit more complex. As demonstrated above. I'm sure the writers of Objective-C have a good reason for this, but one more level of abstraction could make Objective-C that much friendlier to it's programmers and isn't that what it's all about in the end...getting more people to develop in your language.
Some of other comparisons you might want to use are:
NSOrderedAscending -- The left operand is smaller than the right operand.
This is equivalent to using "<" in most languages.
NSOrderedDescending -- The left operand is greater than the right operand.
This is equivalent to using ">" in most languages.