array functions
with loop