NSNumber with IF statement issue

ios, nsnumber, objective-c

Solution

Use `isEqual:`

if ([value isEqual:@(0)])

That will also evaluate correctly in case `value` is `nil` (where `==` comparison with `floatValue` or similar methods would fail)

Problem

I am loading data from a server but I have an issue that the value that I am returning is zero(0) while I can't go inside if. Please where would be the problem? ``` -(void)method1 { NSNumber *value = [data objectForKey:@"samount"]; NSLog(@"number is -%@-", value); //number is -0- if (value == 0) { NSLog(@" OK :) "); } else { NSLog(@" Bad :( "); } } ```

Original source