I'm trying to eval an expression in a try block and it doesn't seem to work.
a=[]
for i=1:4
    try
        if i==3 error() end
        eval(:(push!(a,i)))
        catch e
    end
end

a

After running the above code a evaluates to: 

0-element Array{Any,1}

I'm expecting and want the same result as the code below which evaluates to: 
3-element Array{Any,1}:
 1
 2
 4

a=[]
for i=1:4
try
 if i==3 error() end
 push!(a,i)
 catch e
 end
end

a

Is there a way to get expression evalution to work in this case?

Reply via email to