I have some arrays that I put into one array called alist[]
. I am iterating over the array to print out all values of alist[]
. I need to find a value at alist[2][i]
and then remove the alist[0][i]
, alist[1][i]
, alist[2][i]
, alist[3][i]
, alist[4][i]
from my array alist[][]
. (I removed the code that fills my arrays so it is easier to read my question)
This is my best guess below but it is not working. Would anyone have any ideas?
#declare arrays
nsymbol = []
sname = []
etf = []
testv = []
financials = []
alist = []
#create one array with all other arrays
alist.push(nsymbol, sname, etf, testv, financials)
(0...nsymbol.length).each do |i|
(0...alist.length).each do |j|
if (alist[2][i] || '').include? 'Y'
alist.delete_at(0)
alist.delete_at(1)
alist.delete_at(2)
alist.delete_at(3)
alist.delete_at(4)
end
#print whole array out
puts alist[j][i]
end
end