This works:
julia> for i = 1:1000
if i % 3 == 0 || i % 5 == 0
global var += i
end
end
This is the global scope issue, see Another possible solution to the global scope debacle.
Also note that for speed, you need to do your computations inside a function. Where that loop will work just fine (without the global
).