I recommend working within the REPL where you have global softscope.
julia> V=1
for i in 1:2
print(V)
V=2
end
12
Outside of the REPL, you need to declare V as a global within the for loop. Alternatively and preferably, execute this within a function.