If array = [1, 2, 3, 4, 5, 6, 7, 8, 9], I want to delete a range of elements from array.
array = [1, 2, 3, 4, 5, 6, 7, 8, 9]
For example: I want to delete all elements with an index in th
Use slice!:
Deletes the element(s) given by [...] a range.
array = [1, 2, 3, 4, 5, 6, 7, 8, 9] array.slice!(2..5) array #=> [1, 2, 7, 8, 9]