How do I initialize an empty array / vector of strings, and then push strings into it? When I do t = Vector{String}
, I get this error when I then push into it:
push!(t, "a")
ERROR: MethodError: no method matching push!(::Type{Array{String,1}}, ::String)
Closest candidates are:
push!(::Any, ::Any, ::Any) at abstractarray.jl:2252
push!(::Any, ::Any, ::Any, ::Any...) at abstractarray.jl:2253
push!(::Array{Any,1}, ::Any) at array.jl:940
and t = Array{String}
results in the same error.
(I want to specify the type that the vector will be filled with in advance because the array will subsequently go into a namedtuple)
Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appropriate answer back to Slack, or pinging the poster here on Discourse so they can follow this thread.
(Original message ) (More Info)