personal function 10 - function with array loop