Re:Why is zero not falsy in Clojure? (2015)
by the_only_human on Friday May 20, 2022 @10:56AM
(#31448331)
in your example, the end result is the same. the user is not interested in luggage.
[ Parent
| on HN ]
Re:Why is zero not falsy in Clojure? (2015)
by happytoexplain on Friday May 20, 2022 @10:57AM
(#31448352)
The difference between an answered and unanswered question is absolutely not the same. Nil means the user has not told us how much luggage they have. 0 means the user has 0 luggage. We can assume a lack of response means zero, or we can mark the field as required, in which case the UI needs to prompt the user for a response in the nil case but not the 0 case. This is an extremely simple, common example. There are many cases where nil is not equivalent to 0 semantically or logically.