Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone : Difference between nil vs Nil and true vs TRUE

What is difference between nil and Nil in iOS development?

And similarly what is difference between true and TRUE in iOS development?

like image 341
Devang Avatar asked Mar 06 '12 06:03

Devang


1 Answers

nil is the literal null value for Objective-C objects, corresponding to the abstract type id or any Objective-C type declared via @interface. For instance:

NSString *someString = nil;
NSURL *someURL = nil;
id someObject = nil;

if (anotherObject == nil) // do something

Nil is the literal null value for Objective-C classes, corresponding to the type Class. Since most code doesn’t need variables to reference classes, its use is not common. One example is:

 Class someClass = Nil;
 Class anotherClass = [NSString class];
like image 62
sinh99 Avatar answered Nov 09 '22 05:11

sinh99