Null, NIL, nil, null


So we’ve got lots of options here.

I did a little research and I don’t feel too sure why as programmers we try to make our words mean what they will be used for.

So it seems that null and nil are case sensitive and have different uses.

I’m a young programmer so I haven’t used these in the wild so much. Can someone help me understand the difference and which gets used most often?
This is my understanding currently:
nil (all lower-case) is a null pointer to an Objective-C object.
Nil (capitalized) is a null pointer to an Objective-C class.
NULL (all caps) is a null pointer to anything else.


The only two you’re likely to see when programming for Mac an iOS are nil (all lowercase) and NULL (all uppercase).

Actually, it turns out that they’re exactly the same. From MacTypes.h in the system libraries:#define nil NULL

But you’re right, coloquially, we use nil for Objective-C object pointers, and NULL for everything else.


Cool! Thanks Mikey!