3 ms·
Those languages use three value logic?
by herdrick 6y ago
Those languages use three value logic?
- rovolo 6y agoI think they mean that NULL is a part of the type system, rather than an overloaded value of the same type. You can't assign NULL to a Boolean, but you can assign NULL to a nullable Boolean. From the article: > The programming language null is a value but database null is not a value. Those languages can use three value logic, but only if the type is marked as nullable. Newer languages have syntactic sugar to make it easier to handle null, which means that most functions can be written assuming their inputs are non-null. SQL by contrast defines most functions to handle nullable types. Here are some examples in kotlin (all ? relate to nullability, see a tutorial for more info): val b : Boolean? = null b.and(true) // type error b?.and(true) // null (b ?: true).and(true) // true b?.let { bb -> true.and(bb) } // null