Why does this give an UndefVarError?
i = 1
println(i)
let
println(i)
local i = 2
println(i)
end
println(i)
I feel like the first i appeared in let block is defined, not undefined, because if I delete the local i = 2, it works.
Why does this give an UndefVarError?
i = 1
println(i)
let
println(i)
local i = 2
println(i)
end
println(i)
I feel like the first i appeared in let block is defined, not undefined, because if I delete the local i = 2, it works.
Note that as documented,
The location of both the
localandglobalkeywords within the scope block is irrelevant.
See the examples.