Ahsan Ahsan - 6 months ago 46
Objective-C Question

How to compare two NSInteger?

How do we compare two NSInteger numbers ? I have two NSIntegers and comparing them the regular way wasnt working.

if (NSIntegerNumber1 >= NSIntegerNumber2) {
//do something
}


Eventhough, the first value was 13 and the second value was 17, the if loop is executing

Any idea ?

Answer
NSInteger int1;
NSInteger int2;

int1 = 13;
int2 = 17;

if (int1 > int2)
{
    NSLog(@"works");
}
Comments