Hey folks,

I feel like there's a really, really simple solution to this problem, =
but I'm just missing it.



<-----code----->
array1 =3D ["0", "1", "2", "3"]
array2 =3D ["jam", "bees", "please"]
array3 =3D ["6", "7", "8"]

array1.each do |a|
  array2.each do |b|
    array3.each do |c|
      puts "#{a} #{b} #{c}"
    end
  end
end
<-----/code----->

The output of that little snippet is all of the possible iterations of =
the three arrays.

I want to generalise this, such that if I have an arbitrary length array =
of arrays:

arrayCollection =3D [["0", "1", "2", "3"], ["jam", "bees", "please"], =
["6", "7", "8"]]

I can get the same output.=20

In my mind's eye, I see:

arrayCollection.each do |subarray|
end

as the start, to get to each subarray, but I can't see what the next =
step would be.

Any pointers in the right direction?


thanks!

James=