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.
私は2つの配列を持っています:
array1 = ["H", "e", "l", "l", "o"] array2 = ["o", "l", "l", "e", "H"]
array1 要素が新しいハッシュのキーになり、array2 要素が同じハッシュの対応する値になるようにします。誰かがこれを行う方法を提案できますか?
ありがとう
array1 = ["H", "e", "l", "l", "o"] array2 = ["o", "l", "l", "e", "H"] p Hash[array1.zip(array2)] # >> {"H"=>"o", "e"=>"l", "l"=>"e", "o"=>"H"}