I have a piece of code in Julia here:
i = 1
while true
if i == 10
break
end
global i += 1 #A
for k = 1:1
println(i) #B
end
end
println(i)
My question is why global i += 1 #A is required inside while loop, but println(i) #B inside the for loop is not requiring any global declaration?
Is global declaration required only for the modification of variables? The if i == 10 statement after the while declaration is using the global scope.