Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.7K Views
|
6 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Missing[] vs Null

Posted 3 years ago

Hello,
I see there are Missing[] and Null in Mathematica, but what are their differences?
Thanks.

POSTED BY: Zhenyu Zeng
6 Replies
Posted 3 years ago

Okay. I know more from your reply. Thanks a lot!

POSTED BY: Zhenyu Zeng
Posted 3 years ago
POSTED BY: Eric Rimbey
Posted 3 years ago
POSTED BY: Eric Rimbey
Posted 3 years ago

Hello, Thanks for your help. I have several questions after reading your reply:

  1. On the one hand, it's a plain 'ol symbol. What's `ol symbol?
  2. a; evaluates to Null. What is a and why it evaluates to Null?

Thanks.

POSTED BY: Zhenyu Zeng

About question 2: Execute this:

FullForm[Hold[a;]]

You will see that the full form contains a Null (this is how the input syntax of WL is defined):

HoldForm[CompoundExpression[a,Null]]

And CompoundExpression returns the last expression (evaluated, but Null evaluates to Null).

Null has been around since the beginning. When I was learning Mathematica and coming from the C & Pascal programming languages, I used to think of Null as what a procedure returned (void in C) as opposed to an "actual" value returned by a function (which has to have a type in C). Of course, every WL function returns something. But if you execute a command that returns Null, you get, as Eric already mentioned, no output in the notebook. That seemed like a "procedure" to me.

Missing[] was introduced as Mathematica was expanded to handle data and data sets, including curated data like CountryData[]. Since Missing[] may have arguments, it allows for more robust handling of data, which has grown in importance since Mathematica began. (By "data sets" I don't mean Dataset, which was a big step in the evolution of how data is handled and came a while after Missing[] was introduced.)

POSTED BY: Michael Rogers
Posted 3 years ago

Thanks a lot. Your answer makes me understand more deeply about Mathematica.

POSTED BY: Zhenyu Zeng
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard