firstMatchValue = -1
array1 = [1, 2, 3]
array2 = [2, 3, 4]
catch (:done) do
for i in array1
for n in array2
if i == n
firstMatchValue = i
throw :done
end
end
end
end
# firstMatchValue is 2
puts firstMatchValue