Skip to content
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

Add local to for outer description #29010

Merged
merged 1 commit into from
Sep 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/src/manual/variables-and-scoping.md
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ julia> f()
0
```

However, it is occasionally useful to reuse an existing variable as the iteration variable.
However, it is occasionally useful to reuse an existing local variable as the iteration variable.
This can be done conveniently by adding the keyword `outer`:

```jldoctest
Expand Down
2 changes: 1 addition & 1 deletion src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -2430,7 +2430,7 @@
'(null))
((eq? (car e) 'require-existing-local)
(if (not (memq (cadr e) env))
(error "no outer variable declaration exists for \"for outer\""))
(error "no outer local variable declaration exists for \"for outer\""))
'(null))
((eq? (car e) 'lambda)
(let* ((lv (lam:vars e))
Expand Down
2 changes: 1 addition & 1 deletion test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3256,7 +3256,7 @@ let
@test forouter() == 3
end

@test_throws ErrorException("syntax: no outer variable declaration exists for \"for outer\"") @eval function f()
@test_throws ErrorException("syntax: no outer local variable declaration exists for \"for outer\"") @eval function f()
for outer i = 1:2
end
end
Expand Down