generate a method to repeatedly return each value in a given array