Julia Language Pits & Falls


Example

# no error, even the subscript is out of range.
julia> sub2ind((3,3), 3, 4)
12

One cannot determine whether a subscript is in the range of an array by comparing its index:

julia> sub2ind((3,3), -1, 2)
2

julia> 0 < sub2ind((3,3), -1, 2) <= 9
true