R
Rafael George
Hi, im trying to compare two arrays and creating a new one with the
values that are in the second array and the values that aren't
concatenated with "NOT FOUND", here is the snippet code. Im getting a
weird result im getting the same values saying "not found" and without
the concatanation, can somebody please give me a hint of what is going
on.
Thanks in advance.
def handle_data(data1,data2)
c = 0
t = 0
result = []
while c < data1.length
k = 0
while k < data2.length
if data1[c].length > 7
result[t] = data1[c].include?(data2[k]) ? data1[c] :
data1[c]+" NOT FOUND"
t += 1
end
k += 1
end
c += 1
end
return result.uniq
end
values that are in the second array and the values that aren't
concatenated with "NOT FOUND", here is the snippet code. Im getting a
weird result im getting the same values saying "not found" and without
the concatanation, can somebody please give me a hint of what is going
on.
Thanks in advance.
def handle_data(data1,data2)
c = 0
t = 0
result = []
while c < data1.length
k = 0
while k < data2.length
if data1[c].length > 7
result[t] = data1[c].include?(data2[k]) ? data1[c] :
data1[c]+" NOT FOUND"
t += 1
end
k += 1
end
c += 1
end
return result.uniq
end