You can always declare a variable as local
to avoid it picking up any previous definitions:
function f()
i = 100
for j in 1:2
local i = 0
i = i + j
end
println(i)
end
julia> f()
100
You can always declare a variable as local
to avoid it picking up any previous definitions:
function f()
i = 100
for j in 1:2
local i = 0
i = i + j
end
println(i)
end
julia> f()
100