Soma
Soma

Reputation: 743

Why is the " UndefVarError: undef not defined " error happened?

It is used in the code: tt=Array{Int64}(undef,0) but the following error is shown: UndefVarError: undef not defined would you please say why it happened? and is there any alternative for the code?

Upvotes: 0

Views: 704

Answers (2)

Przemyslaw Szufel
Przemyslaw Szufel

Reputation: 42194

If you want an empty vector just write (should work in very old and new Julia):

tt = Int64[]

or even tt = Int[] if you are on a system with 64 bit ints (which is almost always true)

Upvotes: 1

Naetmul
Naetmul

Reputation: 15552

undef was introduced in Julia 0.7. If you are using a lower version, update Julia.

Or you can try tt=Array{Int64}(0). I don't know whether this works in your system.

Upvotes: 1

Related Questions