# Bug with Julia 1.0.1

**URL:** <https://discourse.julialang.org/t/bug-with-julia-1-0-1/15964>\
**Category:** Internals & Design\
**Created:** [October 6, 2018, 11:50am UTC](https://discourse.julialang.org/t/bug-with-julia-1-0-1/15964 "2018-10-06T11:50:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [October 6, 2018, 11:50am UTC](https://discourse.julialang.org/t/bug-with-julia-1-0-1/15964/1 "2018-10-06T11:50:01Z")

</div>

I tried to run the following code in Julia 1.0.1 and it fails and I ran the same code in v0.6.4 and it works and I’ve checked and checked and I think it’s an error with v1.0.1.

```julia
last_f = 0
max_lrn = 0
pos_of_max = 0
lrn = 1:100
feature = 1:100

for i in 2:length(feature)
    if feature[i] != last_f
        if lrn[i] > max_lrn
            max_lrn = lrn[i]
            pos_of_max = i
        end
    end
end

```

gives error

> UnderVarError: max\_lrn not defined

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [October 6, 2018, 11:55am UTC](https://discourse.julialang.org/t/bug-with-julia-1-0-1/15964/2 "2018-10-06T11:55:06Z")

</div>

```julia
for i in 2:length(feature)
           global max_lrn
           if feature[i] != last_f

```

There are good reasons it works this way in 1.x but there are also significant reservations about this behavior. That’s what [this issue](https://discourse.julialang.org/t/another-possible-solution-to-the-global-scope-debacle/15894) is about.

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [October 6, 2018, 11:57am UTC](https://discourse.julialang.org/t/bug-with-julia-1-0-1/15964/3 "2018-10-06T11:57:41Z")

</div>

Interesting. I tried the same code in v0.7 and it did give a Warning.
