I have two arrays:
a = [1, 2 ,3]
b = [4, 5, 5]
I want to iterate over all elements of both arrays. One way of doing so would be the following:
(a + b).each do |element|
puts element
end
This creates a third array from a
and b
and then iterates over it. Are there more elegant/Rubyist methods to do the same?