Loop doesn't work

Note that you are apparently using an ancient version of Julia (< 1.5). If you upgrade to the latest version (1.6), then (a) your code will work fine in an interactive environment (e.g. the REPL) and (b) in a script it will give a clearer error message. (If you use Jupyter notebooks, then it will work in earlier versions too.)

See also long discussions at Another possible solution to the global scope debacle and RFC: bring back v0.6 scope rules in the REPL by JeffBezanson · Pull Request #33864 · JuliaLang/julia · GitHub

4 Likes