I would like to split a string and append the split result to two separate arrays simultaneously. Is there a way to do this? For example:
mystrings = ['abc:def', 'ghi:jkl', 'mno:pqr']
first = []
second = []
mystrings.each do |string|
first, second << string.split(':')
end
This doesn't work. But I didn't know if there was a syntactical Ruby way to perform the split and appending simultaneously.