Array{Int64,1} is a type – it's the type of an array with 1 dimension (a vector) whose elements are 64-bit signed integers. You can't push anything onto a type because types aren't containers. If you want to construct an uninitialized three value Int array, you can do this:
v = Array(Int, 3) This will just have junk values gotten via malloc. If you want to initialize an Int array with the values 10, 11 and 12 you can do this: v = [10, 11, 12] It will have element type Int because all the values you gave it are Ints. On Thu, Dec 18, 2014 at 2:21 PM, <jgabriele...@gmail.com> wrote: > I see that I can do: > > b = Array{Int64, 1} > #=> Array{Int64,1} > > but why can't I push anything to that?: > > push!(b, 10) > # ERROR: `push!` has no method matching push!(::Type{Array{Int64,1}}, > ::Int64) > > Hm. Can't push anything to this either though: > > ~~~ > c = [] > #=> 0-element Array{None,1} > push!(c, 10) > ERROR: [] cannot grow. Instead, initialize the array with "T[]", where T > is the desired element type. > in push! at ./array.jl:457 > ~~~ > >