Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ここに私の配列があります
a = [["A", "B"], ["323", "32"]]
今私ができるようにしたいのは、この配列を次のようにフォーマットすることです
A = 323 B = 32
どうすればいいのですか ?
ありがとう
あなたが探しているのはArray#transpose、私は信じています:
Array#transpose
> a = [["A", "B"], ["323", "32"]] => [["A", "B"], ["323", "32"]] >> a.transpose => [["A", "323"], ["B", "32"]]
(0...a.first.length).each{|i| puts "#{a[0][i]} = #{a[1][i]}"}