-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG in a42a? #28
Comments
I think the scope of the variable does not escape the iteration unless you specify so. julia> function k1()
for i in 1:3
i == 1 || println(f)
f = 1
end
end
k1 (generic function with 1 method)
julia> function k2()
local f
for i in 1:3
i == 1 || println(f)
f = 1
end
end
k2 (generic function with 1 method)
julia> k1()
ERROR: UndefVarError: f not defined
in k1 at ./none:3
julia> k2()
1
1 |
Hmm that's subtle. I didn't know that. |
Yeah. The document of the scope definitely needs more comprehensive documentation JuliaLang/julia#9955 |
Hopefully this f5f3789 fixes the issue. (I couldn't reproduce the error to be sure.) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is a (partial) traceback:
I've looked over and over this function and cannot figure out why this is happening. The
&&
should short-circuit so thedistinct(f, a, b, d, e)
should only run after the first iteration has completed. Thene
is defined towards the end of every iteration, so by the time this ever executese
should be in scope...EDIT: link to the line in question
The text was updated successfully, but these errors were encountered: