2015-09-23 23 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?