Ref Array method of ary[start, length] = obj or other_ary or nil → obj or other_ary or nil
items[1,0] = ["bottle", "my"]
Here, 1 is Index & Length is 0
As per the documentation ‘Elements are inserted into the array at start if length & index are zero.’
For Ex:-
a = ['A']
a[0, 0] = [ 1, 2 ] #=> array a will be [1, 2, "A"]
Similarly, when Index is non zero & Length is zero ‘Elements are inserted into the array from given Index’
a = ['A']
a[1, 0] = [ 1, 2 ] #=> array a will be ["A", 1, 2]
1
solved Ruby index assignment [closed]