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

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

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.

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

1 Like

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

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.

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

Will do, thanks.

Cross-ref:
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