They are all zeros, the difference lies in their types
-> The NSNull class defines a singleton object used to represent null values in collection objects (which don’t allow nil values).
NSNull is a class for objects that represent null.
-> nil is an id. So its points to a non-existent objective-c object
-> Nil is a non-existent objective-c class
-> [NSNull null] is an object that’s meant to stand in for nil in situations where nil isn’t allowed. For example, you can’t have a nil value in an NSArray. So if you need to represent a “nil”, you can use [NSNull null]
Also there is no ‘null’ in the objective c its ‘NULL’ not ‘null’. ‘null’ exist in Java or in C# not in Objective-C
nil -> Null-pointer to objective- c object
NIL -> Null-pointer to objective- c class
null-> null value for C pointer.
NSNUll -> Singleton object used to represent null.
NSNull [NSNull null] singleton object used to represent null
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];
-> The NSNull class defines a singleton object used to represent null values in collection objects (which don’t allow nil values).
NSNull is a class for objects that represent null.
-> nil is an id. So its points to a non-existent objective-c object
-> Nil is a non-existent objective-c class
-> [NSNull null] is an object that’s meant to stand in for nil in situations where nil isn’t allowed. For example, you can’t have a nil value in an NSArray. So if you need to represent a “nil”, you can use [NSNull null]
Also there is no ‘null’ in the objective c its ‘NULL’ not ‘null’. ‘null’ exist in Java or in C# not in Objective-C
nil -> Null-pointer to objective- c object
NIL -> Null-pointer to objective- c class
null-> null value for C pointer.
NSNUll -> Singleton object used to represent null.
NSNull [NSNull null] singleton object used to represent null
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];
No comments:
Post a Comment