diff --git a/doc/src/manual/variables-and-scoping.md b/doc/src/manual/variables-and-scoping.md index ab6f1962be0c6..47098fe0f9899 100644 --- a/doc/src/manual/variables-and-scoping.md +++ b/doc/src/manual/variables-and-scoping.md @@ -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 diff --git a/src/julia-syntax.scm b/src/julia-syntax.scm index 4a3d43613cff1..bed7108b176fc 100644 --- a/src/julia-syntax.scm +++ b/src/julia-syntax.scm @@ -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)) diff --git a/test/core.jl b/test/core.jl index f6f467183de83..65bd554bc8937 100644 --- a/test/core.jl +++ b/test/core.jl @@ -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