try
and catch
each have their own scope, and local variables aren’t implicitly visible between scopes. Instead, mark the shared variable as local
to the parent scope:
using DataFrames
df = DataFrame(col1=[1,2,3],col2=[6,7,8])
var = 999
for row in eachrow(df)
local var
try
var = row[:1]
println("try $var")
if var > 2
throw(ErrorException("test"))
end
catch
println("catch $var")
end
end