Array

集合操作

x = MultiSet.new([1,1,2,2,3,4,5,6])
y = MultiSet.new([1,3,5,6])

x - y => [2,2,4] 差集
x & y => [1,3,5,6] 交集
x | y =>[1,2,3,4,5,6] 并集

a = [1,2,3]
a.any?
=> true

a.clear
a.any?
=> false

[nil, 1].any?
=> true
[nil, nil].any?
=> false

a = []
=> []
a.empty?
=> true
a = [nil, false]
=> [nil, false]
a.empty?
=> false
a = [nil]
=> [nil]
a.empty?
=> false