also, like I gave the code to scan via indexes.
you changed it to for each.
but you can't rerefence array[index] with for each, so please take the code I provided.