I have the following code, and it is not working. Why is this?
s = 0
for i = 1:2
s += i/2
end
I have the following code, and it is not working. Why is this?
s = 0
for i = 1:2
s += i/2
end
use global s
You haven’t read the scope docs!
s = 0
for i = 1:2
global s += i/2
end
Note that this is a controversial new feature of 1.0: https://github.com/JuliaLang/julia/issues/28789
Many thanks.
You should be able to mark a post as “Solved”, so people don’t waste time looking at it.