UndefVarError: P not defined

qp=0.6

function Plist(xi,qp)

   for i=0.001:5:xi

   push!(P,qp*i)

end

return P

end

P=Plist(240,qp)

Previous code return:
UndefVarError: P not defined
Stracktrace:
[1]Plist(::Int64, ::Float64) at .\In[12]:5
[2] top-level scope at In[64]:1

What is wrong?

P doesn’t seem to be defined anywhere before its use in the function.

3 Likes

It’s true. Thank you very much. Problem resolved