title: Determing whether number is prime in Ruby
body: <p>I'm trying to write a method that returns true or false based on whether the integer being evaluated is prime or not. The below code is something I've cobbled together based on reading Wikipedia articles, previous stackoverflow answers, etc. Currently the program returns true for prime numbers, but doesn't return false. I want to do this without using any built-in functions. How should I fix this? </p>
  
  <pre><code>def prime?(integer)
   (2..integer - 1).each do |x|
    if (integer % x) == 0
     return false
    else
     return true
    end
  end
  end
  </code></pre>