I have 2 arrays like so:
arr1 = [a, b, c]
arr2 = 1, 2, 3]
I want to get:
[a1, a2, a3, b1, b2, b3, c1, c2, c3]
I've tried a few things like
output = arr1.each do |a1|
arr2.each do |a2|
end
end
puts output
But that only lists the first array.
This works:
output = arr1.each do |a1|
arr2.each do |a2|
puts a1 + a2
end
end
But my "output" variable isn't good. I get the desired text in the
console, but I can't reuse it for what I really want to do.
This seems trivial, but I feel stupid. I can't even search for this
properly. Please help... thanks.
···
--
Posted via http://www.ruby-forum.com/.