I have two arrays:
one = ["2cndb", "7bndb", "14accdb", "5ggdb"]
two = [["2cndb", "alive"], ["14accdb", "alive"], ["5ggdb", "not alive"]]
I want to check if each sub-array in two contains any element of one. When it does, I want to add an element "yes" to the sub-array, "no" otherwise.
My code is:
two.each do |item|
if (one.include?('item[0]'))
item.push("yes")
else
item.push("no")
end
end
and I get
two = [["2cndb", "alive", "no"], ["14accdb", "alive", "no"], ["5ggdb", "not alive", "no"]]
But "2cndb", "14accdb", "5ggdb" are present in one. Can You suggest where the problem is?
item[0]without quotes.'item[0]'is notitem[0].