Python users moving to Julia often make a mistake like this:
julia> for i in randint(3): # includes colon
println(i)
# no `end`
ERROR: ParseError:
# Error @ REPL[4]:1:21
# ┌
for i in randint(3):
println(i)
#──┘ ── line break after `:` in range expression
# Error @ REPL[4]:2:15
for i in randint(3):
println(i)
# └ ── Expected `end`
Ideally, the error message should explain that colons aren't needed at the start of a block, and that end blocks are.
julia> for i in randint(3): # includes colon
println(i)
ERROR: ParseError:
# Error @ REPL[4]:1:21
# ┌
for i in randint(3):
println(i)
#──┘ ── Colon (`:`) not needed to begin blocks
# Error @ REPL[4]:2:15
for i in randint(3):
println(i)
# └ ── `for` blocks must be closed with `end` keyword
Python users moving to Julia often make a mistake like this:
Ideally, the error message should explain that colons aren't needed at the start of a block, and that
end
blocks are.