Ruby program to remove the first given number of items from the array

bookmark

arr = [100,101,102,103,104];
item = arr.shift(2);

print "Array: ",arr,"\n";
print "Removed items: ",item,"\n";

 


Output:

Array: [102, 103, 104]
Removed items: [100, 101]