Iterate through all combinations of elements in an arbitrary number of arrays

You can use Iterators.product:

for elements in Iterators.product(arrays...)
  do_stuff(elements)
end
2 Likes