If you are familiar with C, an array is nothing else than a pointer 
pointing the first element of an array. 

So `x[0]` is the first element (C is 0-based), `x[1]` is just the pointer 
moving forward by 1 unit. 
`x[]` has the same meaning as `x[0]`. 

Obviously, Julia inherits this convention.



On Saturday, September 19, 2015 at 7:42:57 PM UTC+2, Ismael VC wrote:
>
> I would have expected an error.
>
> Julia:
>
> julia> VERSION
> v"0.4.0-rc1"
>
> julia> x = [1:5;];
>
> julia> x[], x[1]
> (1,1)
>
> Python:
>
> >>> x = range(1, 6)
> >>> x[]
>   File "<stdin>", line 1
>     x[]
>       ^
> SyntaxError: invalid syntax
>
>
>

Reply via email to