Jack Humphries
Jack Humphries

Reputation: 13267

Detect if NSNumber is equal to NULL

How do I detect if a NSNumber is NULL? For example, I use a NSLog to display the value of a NSNumber and if there is an incorrect value, such as letters, it shows "null" in the log. Thanks for your help!

Upvotes: 2

Views: 5464

Answers (1)

Arvin Am
Arvin Am

Reputation: 533

Can't you just do

NSNumber *testNumber;

if(testNumber == nil){

NSLog(@"the testNumber is nil");

}

Upvotes: 3

Related Questions