Ruby program to add multiple elements to the end of the array using push() method

bookmark

arr = [101,102,103,104,105];

print "Array elements before push() method: \n", arr,"\n\n";

arr.push(106,107,108,109,110);

print "Array elements after push() method: \n", arr,"\n";

 


Output:

Array elements before push() method: 
[101, 102, 103, 104, 105]

Array elements after push() method: 
[101, 102, 103, 104, 105, 106, 107, 108, 109, 110]