Ruby 3.1 adds Array#intersect? | BigBinary Blog

PHOTO EMBED

Fri May 28 2021 14:33:01 GMT+0000 (Coordinated Universal Time)

Saved by @captm #ruby

1=> x = [1, 2, 5, 8]

2=> y = [2, 4, 5, 9]

3=> z = [3, 7]

4

5=> x.intersection(y) # x & y

6=> [2, 5]

7

8=> x.intersection(z) # x & z

9=> []
content_copyCOPY

https://bigbinary.com/blog/ruby-3-1-adds-array-intersect