我的代码如下。如果我删除最后一个end,它会说unexpected end of input,如果我把它放end回去,它会说unexpected keyword end。我看不出以下代码有什么问题。你能?
n = gets.chomp.to_i
array= Array.new(n, true)
while p<Math::sqrt(n) do
i=p
while (i<=n) do
array[i] = false # not a prime
i+=p
end
while array[p]!=true do
p++
end
end