I want to use expression:
!([1,2,3] & [43,5]).empty?
=> false
!([1,2,3] & [3,5]).empty?
=> true
to check if two arrays contains at least one common value. And I wonder if there is a better way of doing it? Maybe something like:
([1,2,3] & [3,5]).non_empty?
How to write non_empty? method?
([1,2,3] & [3,5]).any?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With