title: Generating All Permutations of Character Combinations when # of arrays and length of each array are unknown
body: <p>I'm not sure how to ask my question in a succinct way, so I'll start with examples and expand from there. I am working with VBA, but I think this problem is non language specific and would only require a bright mind that can provide a pseudo code framework. Thanks in advance for the help!</p>
  
  <p>Example:
  I have 3 Character Arrays Like So:</p>
  
  <pre><code>Arr_1 = [X,Y,Z] 
  Arr_2 = [A,B]
  Arr_3 = [1,2,3,4]
  </code></pre>
  
  <p>I would like to generate ALL possible permutations of the character arrays like so:  </p>
  
  <pre><code>XA1
  XA2
  XA3
  XA4
  XB1
  XB2
  XB3
  XB4
  YA1
  YA2
  .
  .
  .
  ZB3
  ZB4
  </code></pre>
  
  <p>This can be easily solved using 3 while loops or for loops. My question is how do I solve for this if the # of arrays is unknown and the length of each array is unknown?</p>
  
  <p>So as an example with 4 character arrays:</p>
  
  <pre><code>Arr_1 = [X,Y,Z]
  Arr_2 = [A,B]
  Arr_3 = [1,2,3,4]
  Arr_4 = [a,b]
  </code></pre>
  
  <p>I would need to generate:  </p>
  
  <pre><code>XA1a
  XA1b
  XA2a
  XA2b
  XA3a
  XA3b
  XA4a
  XA4b
  .
  .
  .
  ZB4a
  ZB4b  
  </code></pre>
  
  <p>So the Generalized Example would be:</p>
  
  <pre><code>Arr_1 = [...]
  Arr_2 = [...]
  Arr_3 = [...]
  .
  .
  .
  Arr_x = [...]
  </code></pre>
  
  <p>Is there a way to structure a function that will generate an unknown number of loops and loop through the length of each array to generate the permutations? Or maybe there's a better way to think about the problem?</p>
  
  <p>Thanks Everyone!</p>