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

Documentation / Mathematica / Built-in Functions / Programming / Assignments /

PrependTo

FilledSmallSquare PrependTo[s, elem] prepends elem to the value of s, and resets s to the result.

FilledSmallSquare PrependTo[s, elem] is equivalent to s = Prepend[s, elem].

FilledSmallSquare PrependTo[s, elem] does not evaluate s.

FilledSmallSquare You can use PrependTo repeatedly to build up a list, though Sow and Reap will usually be more efficient.

FilledSmallSquare PrependTo works on SparseArray objects, returning ordinary lists if necessary.

FilledSmallSquare See Section 2.5.4.

FilledSmallSquare See also: AppendTo, Sow.

FilledSmallSquare New in Version 1.

Further Examples