Changing a `for` statement to a `while` within `array.fill()`