Mathematica 9 is now available

AppendTo

Usage

AppendTo[s, elem]elem 添加到 s中,并在结果中重新设置 s.


Notes

AppendTo[s, elem] 等价于 s = Append[s, elem].
AppendTo[s, elem] 不计算 s的值.
• 可以重复使用 AppendTo 来创建一个列表.
• 创建一个列表的一个可以选择并且常常更加有效的方法是使用一组形式为s =  s, elem 的赋值,然后在生成的结构中调用 Flatten.
• 参见 Mathematica 全书: 2.4.4节.
• 同时参见: PrependTo.
Further Examples

This defines a list.

In[1]:=  

Out[1]=

This appends the number  to the end of the list.

In[2]:=  

Out[2]=

The original list is changed as a side effect.

In[3]:=  

Out[3]=

On the other hand, Append does not change the new version of the list.

In[4]:=  

Out[4]=

In[5]:=  

Out[5]=

In[6]:=  



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.