I have two arrays
main_array = [[0,[1,4,5]], [1,[4,6,8]], [2,[5,6,7,8]], [3,[9,8]], [4,[7,2]]]
other_array = [[1,4,5],[9,8]]
What I want to do is to delete those elements in main_array
if it can be found in other_array
. (Meaning I will be left with [[1,[4,6,8]], [2,[5,6,7,8]],[4,[7,2]]]
) So I did the following:
other_array.each { |x|
for i in 0..main_array.length-1
main_array.delete(x)
}
It didn't work. Any clues on how I should approach this?