-3
我試圖找到所有的時間在兩個陣列中使用&
比較相同的ID。當我輸出數組時,可以看到有匹配,但是當我試圖通過它們時,它會拋出錯誤no implicit conversion of nil into Array
。查找兩個陣列中的所有ID號
> @fluent_user_ids
=> [2, 4, 5, 5, 6, 9, 8, 8, 7, 7, 12, 165, 166, 171, 174, 176, 177, 142, 206, 207, 208, 209, 214, 215, 216, 10, 229, 230, 232, 234, 236, 237, 238, 233, 233, 240, 241, 242, 243, 244, 250, 251, 252, 253, 254, 255, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 270, 273, 274, 276, 233]
> @nonfluent_user_ids
=> [2, 5, 11, 166, 142, 13, 206, 207, 208, 209, 214, 215, 216, 171, 10, 229, 230, 231, 232, 234, 236, 237, 238, 233, 239, 240, 241, 242, 243, 244, 250, 251, 252, 253, 254, 255, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 270, 273, 274, 276]
> @nonfluent_user_ids & @fluent_users_ids
TypeError: no implicit conversion of nil into Array
from (irb):27:in `&'
爲什麼不能正常工作?提前致謝!
你有一個錯字('@ fluent_user_ids' vs'@ fluent_users_ids')。 – orde
@CarySwoveland好吧 - 會更新。謝謝! – gwalshington