Hello,
I am learning Julia.
Both are arrays but of different types:
julia> {}
0-element *Array{Any,1}*
julia> []
0-element *Array{None,1}*
julia> [] == {}
*true *
Now I am trying to push new data :
julia> a = []
julia> b = {}
julia> *push!(a,"y")*
*ERROR: *[] cannot grow. Instead, initialize the array with "T[]", where T
is the desired element type.
in push! at array.jl:457 (repeats 2 times)
But for [] it works:
julia> *push!(b,"y")*
1-element Array{Any,1}:
"y"
Also using {} I can create Dictionary:
julia> *{"a" => 3}*
*Dict{Any,Any} with 1 entry:*
"a" => 3
Now I am very confused.
1) What is the meaning of { } ? is it a dictionary constructor or an array
constructor of type Any ?
2) Why can't I push into [ ] ?
Thank you in advance!