This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Part ([[...]])

expr[[i]] or Part[expr, i]
gives the i^(th) part of expr.
expr[[-i]]
counts from the end.
expr[[i, j, ...]] or Part[expr, i, j, ...]
is equivalent to expr[[i]][[j]]....
expr[[{i1, i2, ...}]]
gives a list of the parts i1, i2, ... of expr.
expr[[m;;n]]
gives parts m through n.
expr[[m;;n;;s]]
gives parts m through n in steps of s.
  • You can make an assignment like t[[spec]]=value to modify any part or sequence of parts in an expression.  »
  • Part 0 of an expression is its head.
  • Common spans of parts include:
expr[[m;;]]part m through the end
expr[[;;n]]from the beginning to part n
expr[[;;,j]]column j
expr[[m1;;n1,m2;;n2]]submatrix
  • When expr is a list, expr[[{i1, i2, ...}]] gives a list of parts. In general, the head of expr is applied to the list of parts.  »
  • You can get a nested list of parts from expr[[list1, list2, ...]]. Each part has one index from each list.
  • If any of the listi are All or ;;, all parts at that level are kept.
  • If expr is a SparseArray object, expr[[...]] gives the parts in the corresponding ordinary array.  »
  • and can be entered as Esc [[ Esc and Esc ]] Esc or \[LeftDoubleBracket] and \[RightDoubleBracket].
  • In StandardForm, expr[[spec]] can be input as expr[[spec]] or exprspec.
New in 1 | Last modified in 5