请问如何在匹配一个数字在一个数字数组中存在,或者说一个数组怎么判断包含另外一个数组
.4.1 :001 > a=[1,2,3,4,5] => [1, 2, 3, 4, 5] 2.4.1 :002 > b=3 => 3 2.4.1 :003 > a.includes? b NoMethodError: undefined method `includes?' for [1, 2, 3, 4, 5]:Array Did you mean? include? from (irb):3 2.4.1 :004 > a.include? b => true 2.4.1 :005 > b.in? a => true
感谢,很有用,问题解决了
a=[1,2,3,4] b=[2,3,4] b - a == []