2015-09-23 22 views
0

我不明白,这可怎么是:这怎么可能?红宝石如果循环失败

(byebug) missing_association_words.include?(@mtw.first.word) 
false 
(byebug) @mtw.first.word 
text 
(byebug) missing_association_words 
text 

这段代码返回false虽然都包含相同的值。

+0

而@mtw是什么? – 5208760

+2

都是String class的'@ mtw.first.word'和'missing_association_words'? – shivam

+3

值得检查'text'后面的空格。 – Shadwell

回答

0

如果你想检查是否从第二数组中的值也包括在第一阵列中,您可以使用此:

(first_array & second_array).any?