loop over array