Problem with pop!

I don’t understand why it doesn’t recognise the function pop!. Can someone help me please?

The method error gives a good clue as to why this is - in Julia, multiple functions share the same name, and Julia picks which one to use based on the types of the arguments you supplied (this is known as multiple dispatch). In your case, you supplied a_ray (an Array{Int64,1}) and 4 an Int64; there is no function pop! defined for those types so you get an error.

You can see that final function in the Closest Candidates operates on Array{Int64,1} with no integer after; you can see this behaviour in!
(arrays are an ordered container)

In general, if you get errors like this it is often helpful to go to the Julia docs and search for your function there so that you can see examples about how it should be used.

PS - there are some useful style guides for how to post questions on this forum such that people here can best help you here:


For what you want to do, you might want to take a look at Base.deleteat!.

1 Like