Collecting a list of features Julia accidentally has

Here is a feature that JULIA accidentally have

Just realized that zero-based, i.e., offset-based indexing, can easily be done in Julia already:

v[1] == v[begin + 0]

So you can use zero-based array for one dimensional array by sticking in the "begin + " in the array indexs.

julia> myarray = [exp(1),pi,666.0]
3-element Vector{Float64}:
   2.718281828459045
   3.141592653589793
 666.0

julia> for k = 0:length(myarray)-1
         println(myarray[begin + k])
       end
2.718281828459045
3.141592653589793
666.0
6 Likes