3 ms·
Generally, you see NULL when the concept of nothing is represented with the byte value of nothing or 0 (e.g. C). Nil tends to be used in languages where the co
by red_hare 10y ago
Generally, you see NULL when the concept of nothing is represented with the byte value of nothing or 0 (e.g. C).
Nil tends to be used in languages where the concept of nothing is represented by some sort of container. In lisp, it's simply the empty list (since all data lives in lists in lisp). In Ruby, it's a singleton object that inherits from the same base class as everything else. In both cases, the language is structured such that every container can easily be asked the question "Are you nil?" (as opposed to false or 0).