From: James Harrison Date: 2010-05-17T07:19:05+09:00 Subject: iterating over sub arrays Hey folks, I feel like there's a really, really simple solution to this problem, but I'm just missing it. <-----code-----> array1 = ["0", "1", "2", "3"] array2 = ["jam", "bees", "please"] array3 = ["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 = [["0", "1", "2", "3"], ["jam", "bees", "please"], ["6", "7", "8"]] I can get the same output. 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