title: Ruby unexpected keyword end, AND unexpected end of input
body: <p>My code is as follows. If I remove the last <code>end</code>, it says <code>unexpected end of input</code>, if I put the <code>end</code> back in, it says <code>unexpected keyword end</code>. I cannot see anything wrong with the following code. Can you?</p>
  
  <pre><code>n = gets.chomp.to_i
  array= Array.new(n, true)
  while p&lt;Math::sqrt(n) do
    i=p
    while (i&lt;=n) do
      array[i] = false # not a prime
      i+=p
    end
    while array[p]!=true do
      p++
    end
  end
  </code></pre>