views:

89

answers:

2

This seems so basic but for some reason I can't get it to work - the 2 variables are both defined as NSIntegers:

if ([AScore == "100"] && [BScore == "100"]) {
       ...
}

That doesn't work - nor does it work when I take away the parentheses - nor does it work if I try to implement the 'isEqualToString' command. I'm sure this is a very basic mistake that i am making.

+6  A: 

NSIntegers aren't objects, nor are strings integers.

Use if(AScore == 100 && BScore == 100) { instead.

Dave DeLong
Nor are square brackets used for comparisons.
Chuck
A: 

I wrote an overview of NSNumber versus NSInteger that may be helpful for those new to Cocoa/iOS:

NSNumber versus NSInteger

John