Mega Code Archive

 
Categories / Ruby / Array
 

Array[1, 2] references two array elements, starting with the element at index 1, and this statement replaces two elements in the arr

array = ["Hello", "there", "AAA", 1, 2, 3] array[1, 2] = "here" p array