我有一个数组(更准确地说是嵌套数组),如下所示:
[["Armando", "P"], ["Dave", "S"], ["Richard", "R"], ["Michael", "S"],
["Allen", "S"], ["Omer", "P"], ["David E.", "R"], ["Richard X.", "P"]]
我想一次将两个元组作为参数传递给另一个函数,例如:
rps_result(["Armando", "P"], ["Dave", "S"])
rps_result(["Richard", "R"], ["Michael", "S"])
当我遍历我的数组时,我正在尝试这样做:
arr.each_slice(2) do |first, second|
rps_game_winner([first, second])
end
但是,当我打印参数的值时,这并没有给出想要的答案。我在这里做错了什么?