-1

这是我的示例代码

:key1 => "a"
:key2 => "b"
:key3 => "c"
array1 = [[:key1, :key1, :key1],[:key1, :key2, :key3],[:key2, :key2, :key1]]
array1.each { |x| if x.sym_tos == "a"
                     puts "All match!"
                  else
                     puts "no match"
                  end
             }

然而,当我运行它时,我得到以下错误代码: undefined method `sym_to_s' for [:R1C1, :R1C2, :R1C3]:Array (NoMethodError)

4

1 回答 1

2

你可能想说

if x.uniq.length == 1
于 2013-10-04T02:29:37.460 回答