Ruby 循环使用时有多个条件。包括?红宝石

Ruby 循环使用时有多个条件。包括?红宝石,ruby,watir,Ruby,Watir,这里有很多关于多个while循环的好信息,但是没有一个可以使用。包括吗 我试图让下面的while循环工作,但没有用。我非常感谢你的帮助 while browser.text.include? 'No results found for' || browser.text.include? '- did not match any documents.' 您是否可能只需要添加括号 e、 g: 我真的很喜欢将数据与逻辑分开,即使我们只有两个值 no_result_strings = ['No res

这里有很多关于多个while循环的好信息,但是没有一个可以使用。包括吗

我试图让下面的while循环工作,但没有用。我非常感谢你的帮助

while browser.text.include? 'No results found for' || browser.text.include? '- did not match any documents.'

您是否可能只需要添加括号

e、 g:


我真的很喜欢将数据与逻辑分开,即使我们只有两个值

no_result_strings = ['No results found for', '- did not match any documents.']

while no_result_strings.any?{|no_result| browser.text.include?(no_result)} do
    puts 'found no result, will continue.'
end

#Or, if browser.text is a string and you want it shorter:

while no_result_strings.any?{|x|browser.text[x]} do
    puts 'found no result, will continue.'
end
定义什么使它“有效”。我想你的意思是需要“括号”而不是“父母?
no_result_strings = ['No results found for', '- did not match any documents.']

while no_result_strings.any?{|no_result| browser.text.include?(no_result)} do
    puts 'found no result, will continue.'
end

#Or, if browser.text is a string and you want it shorter:

while no_result_strings.any?{|x|browser.text[x]} do
    puts 'found no result, will continue.'
end