Your code is legal and, when I paste it in my REPL, there are no errors. Can you provide more details about what, exactly, you did that led to these error messages?
Sure. Maybe I am running the code in the wrong way.
I have a script “test.jl” that includes only the lines given above. I select all of it, and copy-paste it into the command line. That gives me the reported errors.
To elaborate on what’s happening here, that REPL is trying to evaluate incomplete but so-far-valid input. The normal terminal REPL waits for a complete input. It might have something to do with “paste mode” behaving strangely or maybe whatever very old setup you’re using was just broken this way, hard to say or remember. In any case there’s no reason to be using Julia 1.0 at this point, use a newer Julia and an up-to-date IDE.
Notice that even in the lines which do work, one newline in your editor is becoming two newlines in the REPL. This could be some quirk of OS line-endings and copy-paste?
The REPL allows one completely empty line, but on the second one, it gives up and presumes this was your complete input:
julia> for tt = 1:Tend # with one empty line, as above
Period_all[tt] = timeidx;
timeidx = timeidx + 0.25;
end
julia> for tt = 1:Tend # with two empty lines -- fails
ERROR: syntax: incomplete: premature end of input
Stacktrace:
[1] top-level scope
@ none:1
Aside from the above suggestions, if you’re willing to use VSCode instead you can add the Run extension and will then be able to right click inside your script and click Run as long as the Julia path is defined.