Reputation: 33
The duplication of p1
, p2
, p3
bugs me.
y.zip(r, q).each { |p1, p2, p3|
puts '%5s %5s | %3s' % [p1, p2, p3]
}
Maybe there is a solution with map
? Is there a way to insert the variables directly into the string rather than using this formatting?
Upvotes: 0
Views: 51
Reputation: 36860
Each element of the zip
'd array is an array, you can just use the whole array
y.zip(r, q).each {|p| puts '%5s %5s | %3s' % p}
Upvotes: 5