Problems with Julia defining empty Arrays


#1

Hi

I just started to follow the lectures for Julia and I am stuck at the very beginning. In the code on https://lectures.quantecon.org/jl/julia_by_example.html (User defined functions), I try to run it on Jupyter, and I get,

MethodError: no method matching Array{Float64,N} where N(::Int64)
Closest candidates are:
Array{Float64,N} where N(!Matched::UndefInitializer, !Matched::Int64) where T at boot.jl:408
Array{Float64,N} where N(!Matched::UndefInitializer, !Matched::Int64, !Matched::Int64) where T at boot.jl:409
Array{Float64,N} where N(!Matched::UndefInitializer, !Matched::Int64, !Matched::Int64, !Matched::Int64) where T at boot.jl:410

Stacktrace:
[1] generate_data(::Int64) at .\In[32]:3
[2] top-level scope at In[32]:clock11:

Any idea of what is going on?

Many thanks!


#2

Hi, are you using Julia 1.0? This constructor has been deprecated, so you’d need something like Array{Float64}(undef, N).

In general, when posting bugs, it’s good practice to also put the results of versioninfo(), so that people can see what your local setup is like.