3 ms·
Another alternative is putting the code in a function and calling that function. function test() s = 0 for i = 1:10 t = s + i
by forgotpwd16 2y ago
Another alternative is putting the code in a function and calling that function.
function test()
s = 0
for i = 1:10
t = s + i
s = t
println("$s")
end
println("$s")
end
test()
For anyone curious, the rationale for this scoping is explained in the docs. Essentially it's to prevent the so-called spooky action at distance.