Looping through an array?

Of course you can

Show your entire code

Otherwise we can’t know what you did wrong