# Why does the soft scope warning not appear in a nested loop?

**URL:** <https://discourse.julialang.org/t/why-does-the-soft-scope-warning-not-appear-in-a-nested-loop/72646>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [December 6, 2021, 11:08am UTC](https://discourse.julialang.org/t/why-does-the-soft-scope-warning-not-appear-in-a-nested-loop/72646 "2021-12-06T11:08:31Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![Nathan\_Boyer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nathan_boyer/32/14825_2.png) [@Nathan\_Boyer](https://discourse.julialang.org/u/Nathan_Boyer)\
**Post date:** [December 6, 2021, 2:44pm UTC](https://discourse.julialang.org/t/why-does-the-soft-scope-warning-not-appear-in-a-nested-loop/72646/8 "2021-12-06T14:44:01Z")

</div>

You can always declare a variable as `local` to avoid it picking up any previous definitions:

```julia
function f()
   i = 100
   for j in 1:2
       local i = 0
       i = i + j
   end
   println(i)
end

julia> f()
100

```

---

_[View the full topic](https://discourse.julialang.org/t/why-does-the-soft-scope-warning-not-appear-in-a-nested-loop/72646)._
