I have two arrays
arr1 = ["a","b","c","d"]
arr2 = ["e","f","g","h"]
and I want to get a result like this
arr3 = ["ae","bf","cg","dh"]
How can I do that in ruby?
I have two arrays
arr1 = ["a","b","c","d"]
arr2 = ["e","f","g","h"]
and I want to get a result like this
arr3 = ["ae","bf","cg","dh"]
How can I do that in ruby?
I'd do using #zip
:
arr1 = ["a","b","c","d"]
arr2 = ["e","f","g","h"]
arr1.zip(arr2).map(&:join)
# => ["ae", "bf", "cg", "dh"]