Hello to all,

Please some help.

I have this array of arrays.

x = [ [“a”,“b”,“c”,“2”], [“d”,“e”,“f”,""], [“g”,“h”,“i”,“j”] ]

And I’m trying to print the Nth element of each array grouped by blocks

like below:

Begin

- Value a -
- Value d -
- Value g -

End

Begin - Value b -
- Value e -
- Value h -

End

Begin - Value c -
- Value f -
- Value i -

End

Begin - Value 2 -
- Value -
- Value j -

End

I’m trying with this loop but is not working for me.

for j in 0… x.map(&:size).max

p “Begin”

for i in 0…x.size

puts “-” + x[#{i}][#{j}] + “-”

end

p “End”

end

How can this be done?

Thanks in advance