Skip to content

Instantly share code, notes, and snippets.

@oppai
Created April 23, 2014 03:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oppai/11201639 to your computer and use it in GitHub Desktop.
Save oppai/11201639 to your computer and use it in GitHub Desktop.
nullとnil
NSLog(@"%@",nil); // (null)
NSLog(@"%@",NULL); // (null)
NSLog(@"%@",[NSNull null]); // <null>
NSLog(@"%@",@"\0"); // (null)
NSLog(@"%u",NULL == nil); // 1
NSLog(@"%u",NULL == [NSNull null]); // 0
NSLog(@"%u",nil == [NSNull null]); // 0
NSLog(@"%u",[NSNull null] == [NSNull null]); // 1
NSLog(@"%u",[[NSNull alloc] init] == [NSNull null]); // 1
NSLog(@"%u",[[NSNull null] isEqual:nil]); // 0
NSLog(@"%u",[[NSNull null] isEqual:NULL]); // 0
NSLog(@"%u",[[NSNull null] isEqual:[NSNull null]]); // 1
NSLog(@"%u",[[NSNull null] isEqual:[[NSNull alloc] init]]); // 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment