uses while loop and yields array instead of a string