Hi everyone
I came around an unexpected result when using the "continue;" like in the following code snippet. The aim of the code is to execute <other code>, for all objects connected to the centerports of "current" , in case their content is non-zero. If the object is empty, the code block can be skipped and the next (second) connected object should be evaluated.
for (int i = 1;i <= 2;i++) { for (int j = 1;j <= 2;j++) { if (current.centerObjects[j].subnodes.length == 0) { continue; } <other code> } <...> }
Now, when the content of the Object current.centerObjects[1] is 0, so the if block is accessed and the continue statement is called, both the inner and outer for loop stop iterating: only the case i = 1, j = 1 is executed, none of the next iterations (i = 1,j = 2 and i = 2). Simultaneously, I get a Flexscript exception in the System console.
I know I could work around the continue statement by redefining the if expression and put the code in that new block, but this demonstrated that I do not truly understand how "continue" works in a for loop. Hopefully, someone can give me this insight.
Many thanks in advance