In this code, the variable inside the loop “c” is not referenced before it’s value is assigned at runtime, but julia will throw an error
ERROR: UndefVarError: c not defined
for n_iter in 0:10
if n_iter != 0
println(n_iter, " ", c)
end
c = 2
end
To me this is a bit surprising (wouldn’t happen in python). What is the suggested workaround?