Ruby Array - Deletion

  • + 0 comments

    def end_arr_delete(arr) deleted_element = arr.pop deleted_element end

    def start_arr_delete(arr) deleted_element = arr.shift deleted_element end

    def delete_at_arr(arr, index) deleted_element = arr.delete_at(index) deleted_element end

    def delete_all(arr, val) arr.delete(val) end