ab123456
Chemical
- Mar 18, 2003
- 58
Say I had a number of different object and each of these objects could take a different value, how can I create a list of all possible combinations?
I think maybe an example is needed here, say I have one object called A that can take a value between 1 and 3 and object B which can be either 1 or 2, the possible combinations are
1,1
1,2
2,1
2,2
3,1
3,2
I can use nested For .. next loops for this example such as
For A = 1 to 3
For B = 1 to 2
Result = A & B
Next
Next
But the number of objects may be anything from 1 to 12 depending on the user input.
How can I change the number of nested loops depending on the user input?
I think maybe an example is needed here, say I have one object called A that can take a value between 1 and 3 and object B which can be either 1 or 2, the possible combinations are
1,1
1,2
2,1
2,2
3,1
3,2
I can use nested For .. next loops for this example such as
For A = 1 to 3
For B = 1 to 2
Result = A & B
Next
Next
But the number of objects may be anything from 1 to 12 depending on the user input.
How can I change the number of nested loops depending on the user input?