2 ms·
Lua does this as well, and I quite prefer it. If I return a number or nil, I want to check `if ret`, not `if type(ret) == "number"`. The latter suggests that
by samatman 7y ago
Lua does this as well, and I quite prefer it.
If I return a number or nil, I want to check `if ret`, not `if type(ret) == "number"`. The latter suggests that it might be some other type‡, the former that it might be missing entirely.
A language which provides a proper Boolean has no need for the association between zero and falseness, it is a conflation of levels which can lead to subtle bugs.
‡ yes, nil is also a type. I mean some other type of type.