title: Finding a true integer square root from an array
body: <p>I'm sure this is such a simple solution and for that I'm sorry but it's driving me mad. </p>
  
  <p>I'm trying to iterate over an array and find a true integer square root and if there isn't one then square the number instead.</p>
  
  <p>I don't know how to do Math.sqrt() and produce an integer not a float without making all results an integer. Can anyone help?</p>
  
  <pre><code>def square_or_square_root(arr)
    new_arr = []
    arr.each { |num|
      if (Math.sqrt(num)).is_a? Integer
        new_arr &lt;&lt; Math.sqrt(num)
      else
        new_arr &lt;&lt; (num * num)
      end
    }
    puts new_arr
  end
  </code></pre>