# In line evaluation failing for valid (if odd) syntax in while statement

**URL:** <https://discourse.julialang.org/t/in-line-evaluation-failing-for-valid-if-odd-syntax-in-while-statement/17795>\
**Category:** Juno\
**Created:** [November 20, 2018, 11:02pm UTC](https://discourse.julialang.org/t/in-line-evaluation-failing-for-valid-if-odd-syntax-in-while-statement/17795 "2018-11-20T23:02:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![robin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/robin/32/6171_2.png) [@robin](https://discourse.julialang.org/u/robin)\
**Post date:** [November 20, 2018, 11:02pm UTC](https://discourse.julialang.org/t/in-line-evaluation-failing-for-valid-if-odd-syntax-in-while-statement/17795/1 "2018-11-20T23:02:00Z")

</div>

Trying to evaluate the following (meaningless, but I have tried to make it minimal) function

```julia
function checkIt()
    state = []
    while(true)
        break
    end
    return state
end

```

One gets an “complete: “function” at … test.jl” error.

The problem is the “while(true)”, it needs to be written as “while (true)”, or better I suppose “while true”.  
[Space after the while]

However I believe “while(true)” is still valid syntax, it is certainly accepted by the repl.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [November 20, 2018, 11:13pm UTC](https://discourse.julialang.org/t/in-line-evaluation-failing-for-valid-if-odd-syntax-in-while-statement/17795/2 "2018-11-20T23:13:52Z")

</div>

Works fine for me both in the REPL and loading from a file (didn’t try Juno). How are you trying this?

---

<div class="post-metadata">

**Author:** ![robin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/robin/32/6171_2.png) [@robin](https://discourse.julialang.org/u/robin)\
**Post date:** [November 20, 2018, 11:40pm UTC](https://discourse.julialang.org/t/in-line-evaluation-failing-for-valid-if-odd-syntax-in-while-statement/17795/3 "2018-11-20T23:40:16Z")

</div>

The problem only appears to be in Juno, editor pane. So with the file open, on the function shift-enter for inline evaluation.

---

<div class="post-metadata">

**Author:** ![robin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/robin/32/6171_2.png) [@robin](https://discourse.julialang.org/u/robin)\
**Post date:** [November 20, 2018, 11:40pm UTC](https://discourse.julialang.org/t/in-line-evaluation-failing-for-valid-if-odd-syntax-in-while-statement/17795/4 "2018-11-20T23:40:19Z")

</div>

Apologies if this is a double post, my previous reply hasn’t yet appeared.

I think the problem only appears in Juno, using the ‘in-line’ evaluation. So in this test instance I have a file with the above function in it. I hit ‘shift-enter’ with the cursor on the function to ‘evaluate’ it and the error is thrown.

It’s hardly earth-shattering - I just thought I should mention it.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [November 20, 2018, 11:40pm UTC](https://discourse.julialang.org/t/in-line-evaluation-failing-for-valid-if-odd-syntax-in-while-statement/17795/5 "2018-11-20T23:40:59Z")

</div>

Definitely worth mentioning. Maybe also filing as an issue on the Juno repo?

---

<div class="post-metadata">

**Author:** ![robin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/robin/32/6171_2.png) [@robin](https://discourse.julialang.org/u/robin)\
**Post date:** [November 20, 2018, 11:41pm UTC](https://discourse.julialang.org/t/in-line-evaluation-failing-for-valid-if-odd-syntax-in-while-statement/17795/6 "2018-11-20T23:41:58Z")

</div>

Will do, thanks.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [November 21, 2018, 12:39pm UTC](https://discourse.julialang.org/t/in-line-evaluation-failing-for-valid-if-odd-syntax-in-while-statement/17795/7 "2018-11-21T12:39:41Z")

</div>

Cross-ref:  
[https://github.com/JunoLab/Juno.jl/issues/192#issuecomment-440585057](https://github.com/JunoLab/Juno.jl/issues/192#issuecomment-440585057)

Imho we shouldn’t allow this at all, but if someone feels strongly about this please comment at  
[https://github.com/JuliaEditorSupport/atom-language-julia/issues/172](https://github.com/JuliaEditorSupport/atom-language-julia/issues/172)
