Find the reoccurring element in an array with a nested each loop
<p>I initialize an array that has a duplicate element, and then I try to find that very element through a nested each loop.</p>

<pre><code>array=(1..100).to_a
array.insert(5, 100)

array.each do |x|
  m = x
  array.delete(x)
  array.each do |y|
    if m == y
      puts m
    end
  end
end
</code></pre>

<p>Anyone have an idea why this does not work?</p>