更新时间:2023-11-18 23:30:58
怎么样使用的 可枚举所有#?
方法?
What about using the Enumerable#all?
method?
def element_of_same_size?(arr)
arr.all? { |a| a.size == arr.first.size }
end
element_of_same_size?([[1,2], [3,4], [5]])
# => false
element_of_same_size?([[1,2], [3,4], [5, 6]])
# => true