Mega Code Archive

 
Categories / Ruby / Array
 

Using Two Array Indices

array = ["Hello", "there", "AAA", 1, 2, 3] array[2, 1] = "pal" p array array = ["Hello", "there", "AAA", 1, 2, 3] array[3, 0] = "pie" p array array = ["Now", "is", 1, 2, 3] array[2, 0] = ["the", "time"] p array array = ["Hello", "there", "AAA", 1, 2, 3] array2 = array[3, 3] p array2