Hi everyone, I have a pretty basic question. The following code is giving me an UndefVarError, and I can’t understand why.
n=1 for i in 1:3 for j in 4:5 n += 1 end end print(n)
The line incrementing
n is throwing an
UndefVarError: n not defined.
I know I can avoid the problem by enclosing the code in a
let, but that seems to be the wrong fix, so I am wondering what I am missing here (probably about scope).