Local variable inside a loop: why it ERRORs

Isn’t this in the manual:

Note that the local scope of a for loop body is no different from the local scope of an inner function.
Scope of Variables · The Julia Language

It’s the loop body which has its own scope, so for scope purposes it’s the same as calling a function repeatedly.

1 Like