syntax: missing last argument in "2:" range expression when using include("MyModule.jl")

Hi, I am trying to use a customized Module in the same folder as main.jl. (Julia 0.6v)

I used
using MyModule
in main.jl. But it returned an error: syntax: missing last argument in “2:” range expression

Could you please help with this? Thank you!

It is impossible to help with no code to look at (see Please read: make it easier to help you). A qualified guess is that you have something like


somewhere in your code, that should be 2:5 or whatever.

1 Like

Note that a[:7] and a[2:] are not valid slicing syntax in Julia: you must either provide both start and end indices or neither, i.e. a[:] is allowed to get all indices in a dimension.


Thanks, my bad, I thought the error came from main.jl, when it actually came from the module file.