ruby Array key pair value?

arrays, hash, ruby

Solution

try this:

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

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

Problem

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]}" end ``` But my desired output is the following (which the previous code block does not produce): ``` 3 4 5 6 ```

Original source