我正在编写一些代码作为编程问题的解决方案。我刚刚在我的解决方案中引入了一个新功能,它导致了以下错误。请注意,如果没有此功能,错误就不存在。
search.rb:48: syntax error, unexpected keyword_end
search.rb:68: syntax error, unexpected $end, expecting keyword_end
我意识到这是由错误的结尾引起的。我就是找不到。(我已经用注释标记了第一个错误的位置。第二个错误是最后一行代码,这里没有显示。)
def processing_function
qcount = pcount = $n
qstrength = 0
$query_hash.each do |qkey, qvalue|
print "Q",qkey,": "
$page_hash.each do |pkey, pvalue|
qvalue.each_index do |i|
pvalue.each_index do |j|
if qvalue[i]==pvalue[j]
qstrength = qstrength + qcount*pcount
end
pcount--
end #** This is line 48. First error occurs here. **#
qcount--
pcount=$n
end
if qstrength!=0
print "P",pkey," "
end
qstrength=0
end
print "\n"
end
end