use i as index to loop for array