I need to iterate over an array, excluding a value in the middle. I know I can do
(0..10).each do |i|
unless i==6
...
end
end
But I’m wondering if there’s a cleaner way. The closest solution I found was this:
Is there an elegant way to exclude the first value of a range?
I need to do this to iterate through poorly organized data I was given.
1 Answer