我刚开始学习Ruby,今天遇到了一个问题。
numResults = /\d+/.match(ie.div(:id, 'results_label').text)
puts "Results found: "+numResults.to_s
while(numResults > 0)
.
. some more code
.
我在输出中遇到了这个错误:
Exception: undefined method `>' for #<MatchData:0x424c6d4>
这真的很奇怪,因为我在IRB中制作了一个while循环,并且它运行得很好。但是,由于程序停留在条件处,我无法执行循环内的代码。
有人知道问题出在哪里吗?