This clarifies a lot of misunderstandings I had, thank you again.
EDIT: I think I have figured it out – the problem is essentially that I am/was lazy and didn’t bother to wrap the expressions with a call to println(), so the expressions/statements weren’t separated from each other. I.e. I was using it “too interactively”. Here are the relevant parts of the webpage https://docs.julialang.org/en/release-0.4/manual/noteworthy-differences/ which seem to indicate this to me, although I still need to go back to the tutorial later and see whether this works:
Julia has no line continuation syntax: if, at the end of a line, the input so far is a complete expression, it is considered done; otherwise the input continues. One way to force an expression to continue is to wrap it in parentheses.
In Julia, whitespace is significant, unlike C/C++, so care must be taken when adding/removing whitespace from a Julia program.
Julia does not require the use of semicolons to end statements. The results of expressions are not automatically printed (except at the interactive prompt, i.e. the REPL), and lines of code do not need to end with semicolons. println() or @printf() can be used to print specific output. In the REPL, ; can be used to suppress output. ; also has a different meaning within , something to watch out for. ; can be used to separate expressions on a single line, but are not strictly necessary in many cases, and are more an aid to readability.
/EDIT
original post for historical reasons I suppose? it’s not really that important
So just to be clear, these statements are considered “directly before” each other because there is no end of statement character like a semi-colon or something similar?
Here https://docs.julialang.org/en/release-0.4/manual/noteworthy-differences/ it says:
Julia discourages the used of semicolons to end statements. The results of statements are not automatically printed (except at the interactive prompt), and lines of code do not need to end with semicolons.
This is confusing because if a semicolon is not needed to end the statement, but a line break is not enough, then what is sufficient to end the statement?
I guess I am somewhat surprised that docstrings can be placed anywhere, not just inside of a function definition. And it is still somewhat unclear to me what I could have done instead to make the code work.