push!

..  push!(collection, items...) -> collection

Insert one or more ``items`` at the end of ``collection``.

.. doctest::

  julia> push!([1, 2, 3], 4, 5, 6)
  6-element Array{Int64,1}:
   1
   2
   3
   4
   5
   6

Use :func:`append!` to add all the elements of another collection to
``collection``.
The result of the preceding example is equivalent to
``append!([1, 2, 3], [4, 5, 6])``.

Examples

julia> a= Int64[]
       push!(a,1)
       push!(a,2)
2-element Array{Int64,1}:
 1
 2
julia> foo = [1,2,3];

julia> push!(foo, 4, 5, 6);

julia> foo
6-element Array{Int64,1}:
 1
 2
 3
 4
 5
 6

See Also

append!, delete!, deleteat!, empty!, endof, filter, filter!, gc, get!, getkey, haskey, insert!, isempty, keys, map, map!, merge, merge!, pop!, prepend!, push!, reduce, resize!, shift!, splice!, unshift!, values,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: