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


#1

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

I used
include(“MyModule.jl”)
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!


#2

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

2:

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


#3

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.


#4

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