How can I check if a Ruby array includes one of several values?
Posted
by Colen
on Stack Overflow
See other posts from Stack Overflow
or by Colen
Published on 2010-04-08T22:30:41Z
Indexed on
2010/04/08
22:33 UTC
Read the original article
Hit count: 210
I have two Ruby arrays, and I need to see if they have any values in common. I could just loop through each of the values in one array and do include?() on the other, but I'm sure there's a better way. What is it? (The arrays both hold strings.)
Thanks.
© Stack Overflow or respective owner