Problem with a variable

for introduces a new local scope, see Scope of Variables · The Julia Language. See for loop - Scope of variables in Julia - Stack Overflow for some more discussion and solutions.

See also PSA: how to quote code with backticks

2 Likes