|
|
|
|
|
by irjustin
1992 days ago
|
|
#3 is interesting because you can assign arr[-1] and it's valid. But it goes from being a pure array to a mixed array+hash/dict where "-1" is the key. BUT if you set/access arr[0] it's just like an array... arr = []
arr[-1] = 'neg-one-pos'
arr[0] = 'zero-pos'
arr[1] = 'one-pos'
arr # => ["zero-pos", "one-pos", -1: "neg-one-pos"]
That was quite unexpected for me. |
|