Span


represents a span of elements i through j.

i;;
represents a span from i to the end.

;;j
represents a span from the beginning to j.


represents a span that includes all elements.


represents a span from i through j in steps of k.


represents a span from i to the end in steps of k.


represents a span from the beginning to j in steps of k.

;;;;k
represents a span from the beginning to the end in steps of k.

DetailsDetails

  • is equivalent to Take[m, {i, j, k}].
  • can be used to reset a span of elements in a list or other expression.
  • When used in Part, negative i and j count from the end.

ExamplesExamplesopen allclose all

Basic Examples (2)Basic Examples (2)

Take a span of elements from a list:

In[1]:=
Click for copyable input
Out[1]=

Assign to a span of elements:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=

Assign a sequence of different elements:

In[4]:=
Click for copyable input
Out[4]=
In[5]:=
Click for copyable input
Out[5]=
New in 6
New to Mathematica? Find your learning path »
Have a question? Ask support »