If I want to compare two arrays and create an interpolated output string if an array variable from array y exists in x how can I get an output for each
x = [1, 2, 4]
y = [5, 2, 4]
intersection = (x & y)
num = intersection.length
puts "There are #{num} numbers common in both arrays. Numbers are #{intersection}"
Will output:
There are 2 numbers common in both arrays. Numbers are [2, 4]