Skip to content Skip to sidebar Skip to footer

What Is Closer To Python None: Nil Or Null?

What value in objective-C would be more close to the value of None in python? python: x = None 1) obj-C: id x = nil; 2) obj-C: id x = NULL;

Solution 1:

NULL is used for non-object pointers; void *. And nil is used in place of an id. Nil can be used anywhere where you can use NULL. So it would be nil in my opinion as None in Python represent the absence of a value

NULL (void *)0 literal null value for C pointers

nil (id)0 literal null value for Objective-C objects

Post a Comment for "What Is Closer To Python None: Nil Or Null?"