|
[Date Index]
[Thread Index]
[Author Index]
An (undocumented?) feature of CompoundExpression and Out
- To: mathgroup at smc.vnet.net
- Subject: [mg76090] An (undocumented?) feature of CompoundExpression and Out
- From: Szabolcs <szhorvat at gmail.com>
- Date: Wed, 16 May 2007 05:26:20 -0400 (EDT)
- Organization: University of Bergen
I always thought that % was set to the result of the last evaluation.
But it seems that this is not always the case.
In[1]:= 1
Out[1]= 1
In[2]:= %
Out[2]= 1
In[3]:= 2;
In[4]:= %
Out[4]= 2
In[5]:= 3;Null
In[6]:= %
Out[6]= 3
In[7]:= 4;Print[]
In[8]:= %
Out[8]= 4
In[9]:= 5;; (* Mathematica 5.2 *)
In[10]:= %
Out[10]= 5
Note that a; and a;Null are both equivalent to CompoundExpression[a,
Null]. It seems that all those arguments at the end of
CompoundExpression that evaluate to Null are ignored when % is set.
I never expected this behaviour, therefore I have never before tried to
use % when the previous expression was terminated by a semicolon.
I hope that this information will be useful for someone who thought
about ; the same way as I did. :-)
Szabolcs
Prev by Date:
Re: weird behavior when plotting multiple functions in 6.0
Next by Date:
Re: Compatibility woes
Previous by thread:
Re: New 3D graphics primitives in Mathematica 5.2
Next by thread:
bug (?) in Integrate (5.2)
|