Diff missing vs nothing

What is the difference and the idea behind the difference?

I saw somewhere that missing is for data and nothing for everything else.

But why do we not just use either missing xor nothing for all null/missing values

2 Likes

It is explained in the FAQ in the official docs here:
https://docs.julialang.org/en/v1/manual/faq/#Nothingness-and-missing-values-1

It basically comes down to the following: missing is basically for representing missing values in a data set. It therefore just propagates through most basic arithmetic functions and uses three-value logic in boolean contexts. nothing has more of a syntactic role, so it is used as return value for example for functions likeprint, where returning anything else wouldn’t make any sense. Iterators use it as well to signify there aren’t any items left to iterate over. Pretty much any other function will error if passed nothing, so you know right away, where nothing was returned, as it is usually not supposed to just propagate.

9 Likes