# Julia behavior differs across editors

**URL:** <https://discourse.julialang.org/t/julia-behavior-differs-across-editors/17905>\
**Category:** New to Julia\
**Created:** [November 23, 2018, 2:19pm UTC](https://discourse.julialang.org/t/julia-behavior-differs-across-editors/17905 "2018-11-23T14:19:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamanrique](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jamanrique/32/5133_2.png) [@jamanrique](https://discourse.julialang.org/u/jamanrique)\
**Post date:** [November 23, 2018, 2:19pm UTC](https://discourse.julialang.org/t/julia-behavior-differs-across-editors/17905/1 "2018-11-23T14:19:53Z")

</div>

Dear all,  
I’m following the most recent Intro to Julia video and I had problems replicating some of the loops in **Juno**. The example code is this one:

n = 0  
while n \<10  
n += 1  
println(n)  
end  
n

UndefVarError: n not defined  
top-level scope at untitled-d413ed921805dfc69b16f1e54a5a5c4e:64 [inlined]  
top-level scope at none:0  
include\_string(::Module, ::String, ::String) at loading.jl:1008  
include\_string(::Module, ::String, ::String, ::Int64) at eval.jl:30  
(::getfield(Atom, Symbol(“##114#119”)){String,Int64,String})() at eval.jl:94  
withpath(::getfield(Atom, Symbol(“##114#119”)){String,Int64,String}, ::Nothing) at utils.jl:30  
withpath at eval.jl:46 [inlined]  
#113 at eval.jl:93 [inlined]  
with\_logstate(::getfield(Atom, Symbol(“##113#118”)){String,Int64,String}, ::Base.CoreLogging.LogState) at logging.jl:395  
with\_logger at logging.jl:491 [inlined]  
#112 at eval.jl:92 [inlined]  
hideprompt(::getfield(Atom, Symbol(“##112#117”)){String,Int64,String}) at repl.jl:85  
macro expansion at eval.jl:91 [inlined]  
(::getfield(Atom, Symbol(“##111#116”)))(::Dict{String,Any}) at eval.jl:86  
handlemsg(::Dict{String,Any}, ::Dict{String,Any}) at comm.jl:164  
(::getfield(Atom, Symbol(“##19#21”)){Array{Any,1}})() at task.jl:259

But when I use **Jupyter** , it goes like this:

n = 0  
while n \<10  
n += 1  
println(n)  
end  
n

​1  
2  
3  
4  
5  
6  
7  
8  
9  
10

10

Why does this happen? Thank you in advance.

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [November 23, 2018, 2:23pm UTC](https://discourse.julialang.org/t/julia-behavior-differs-across-editors/17905/2 "2018-11-23T14:23:55Z")

</div>

Because of [default to soft global scope by stevengj · Pull Request #720 · JuliaLang/IJulia.jl · GitHub](https://github.com/JuliaLang/IJulia.jl/pull/720). This is a bit of a sore point of Julia 1.0. If you’re interested, search for “scope” in this forum, make yourself a cup of tea or grab a beer and enjoy the read.

PS: please quote your code when posting [PSA: how to quote code with backticks](https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530)

---

<div class="post-metadata">

**Author:** ![jamanrique](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jamanrique/32/5133_2.png) [@jamanrique](https://discourse.julialang.org/u/jamanrique)\
**Post date:** [November 23, 2018, 2:25pm UTC](https://discourse.julialang.org/t/julia-behavior-differs-across-editors/17905/3 "2018-11-23T14:25:15Z")

</div>

Thank you for your answer, will do both.
