How to change a material of an array of GameObject?

So i have been trying this for some time and it seams what im looking for is an array of int values, but i have gotten so deep in trying to fix this simple problem that a solution could be much more simple. If anybody has any ideas please let me know.

Figured it out