title: Find values in common between two arrays
body: <p>If I want to compare two arrays and create an interpolated output string if an array variable from array <code>y</code> exists in <code>x</code> how can I get an output for each matching element?</p>
  
  <p>This is what I was trying but not quite getting the result.</p>
  
  <pre><code>x = [1, 2, 4]
  y = [5, 2, 4]
  x.each do |num|
    puts " The number #{num} is in the array" if x.include?(y.each)
  end #=&gt; [1, 2, 4]
  </code></pre>