Topic: Jumping out of Nested Do's the right way and request for cleverness
As a test/gettoknowya exercise I'm playing with nested Do loops. My project is 10 deep but for simplicity I'll ask about a 3 deep situation.
I've seen commands "Cycle" and "Exit" and I know what they do within one loop. If I am nested in
And I Cycle in C, I know it skips an iteration for C. It seems if I am in B and Cycle out, I skip the iteration for B and ALL of C. Same with A, If I cycle out of A, All of B and C are skipped for that Cycle - Correct?
Now for an Exit, If I Exit in the middle of the increment range of C, I'm still in the loop of B so will come back into C on the next iteration of B - Correct?
So - If I'm in the loop of C and my criteria is meet so I don't need any more looping, what is the best way to exit from the "center" of the three nested Do Loops?
I have read and searched, but most examples deal with simple, 1 tier, cases.
In this exercise, I need to run A, B, and C though numbers 0 thru 9, So I have them nested in Do's, each going from 0 to 9 and a Brute Force visit of possibilities. BUT I ONLY NEED to test a condition with all three indexes are unique.
At this point I have a huge IF statement that check that index A isn't equal to B or C AND B isn't equal to A or C AND C isn't equal to A or B. Is there a more elegant way to run A, B, and C thorough all numbers 0 to 9 but have a cleaner way of testing my condition only when each has a unique value?
In the real situation, I have 10 Do loop indexes and only need to test when all 10 have unique values.
In brute force, it seems like 10 to the power of 10 iterations. It would be nice if I could cut that down by only allowing all ten to take on every value from 0 to 10 but only generate values that are always unique with respect to one another.