not too sure on what your definition of function is I was under the impression that if, else, while, for and the likes were functions
for arrays I have used before using the for (whatever it is) as I have done in the original piece worked
as in the programme made its way through the array