For the following two version of Julia code, the first version is much simple and beautiful. However, it no longer works in Julia 1.
a = 0 # as simple as Python code for i in 1:10 a +=1 end @show a
global a = 0 # The compiler should judge the global variable for i in 1:10 global a # seems tedious, should be the compiler's work a +=1 end @show a
I know when put the code in a function it works in Julia 1. However, when using Jupyter we usually do not put every thing in the function, because global variables from different cells are very convenient.
Is it possible to make the simple version code run in the future version?