3 ms·
() is not null, it's the type that has only one value (think of it like Bool that's always True). Null (or C-void, which it is also often compared to) on the ot
by quchen 13y ago
() is not null, it's the type that has only one value (think of it like Bool that's always True). Null (or C-void, which it is also often compared to) on the other hand stands for a lack of information and is more of a makeshift placeholder.
- groovy2shoes 13y agoThe semantics of (), a.k.a. unit, are effectively the same to those of null, and it can be useful to think of it that way. Both null and unit stand for lack of information and are placeholders. The difference is in the implementation details. http://en.wikipedia.org/wiki/Unit_type http://en.wikipedia.org/wiki/Unit_type