groups = [ %w[hello goodbye], %w[world everyone], %w[here there] ] combinations = groups.first.product(*groups.drop(1)) p combinations # [ # ["hello", "world", "here"], # ["hello", "world", "there"], # ["hello", "everyone", "here"], # ["hello", "everyone", "there"], # ["goodbye", "world", "here"], # ["goodbye", "world", "there"], # ["goodbye", "everyone", "here"], # ["goodbye", "everyone", "there"] # ]
JΓΆrg W Mittag
source share