3 ms·
True, however in software there are many cases in which they're different. Simple example: How many checked luggage items do you have? nil means the user has
by ARandomerDude 4y ago
True, however in software there are many cases in which they're different. Simple example:
How many checked luggage items do you have?
nil means the user hasn't answered the question
0 means they saw the question and don't have any checked luggage.
- the_only_human 4y agoin your example, the end result is the same. the user is not interested in luggage.
- happytoexplain 4y agoThe 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.
- gryn 4y agono that's you assuming since that part was not filled.