TheMouseMan TheMouseMan - 5 months ago 23
Ruby Question

ruby Array key pair value?

I am trying to pair up two key value pairs but I am unsure how to accomplish this. Below is what I have attempted:

struc = Array[(3,4),(5,6)]
for i in 0..1
puts "#{struc[i,i]}"

But my desired output is the following (which the previous code block does not produce):

3 4
5 6


try this:

arr = [[3,4],[5,6]]
arr.each do |(a,b)|
  puts "#{a} #{b}"

Also you array syntax (Array[(3,4),(5,6)]) is incorrect.