Examine the following code:
arr = Array.new(3)
for i in 1..5
arr << i
end
This outputs three blank lines, followed by the numbers 1 through 5.
What I'm trying to do is to create an array with a set size that cannot change, that, when pushed to, will fill up from 0-index to the last, and then just overwrite it with any extras, so that the output here will be just the numbers 1, 2 and 5.
How can I do this?