How to port following Ruby code into Crystal?

Sorry for this question even confusing myself a lot, i really should think carefully before ask this question.

If you try to put a value in an array, but that index is out of bounds, you get an IndexError. Check the docs:

Yes, this really surprised me, i do know IndexError, but happen on empty array is ignored, thank you.

Why do you check what’s in index zero, if it’s clear that the array is empty?

Hope following ruby code describe my question more clearly

h = []

x = ["foo", " bar"].each # just ignore this part.
y = ["foo", " bar"].each

loop do
  h[0] ||= ""  # <= the h here may or may not be empty.
  h[0] << x.next


  # h[1] ||= "" # probably add one or two element, but we don't know before the loop.
  # h[1] << y.next
end

p h # => ["foo bar"]

So, is it possible use Crystal rewrite that? probably h << "" not work in the loop for this case?

Thanks.