Using Exit in inner loop of Multi-depth For ... Next

Hi Folks,

A “what happens if” type question.

When using a 2 or 3 deep For ... Next loop to test for a match to an array of an array (of an array), I’ve always called “Exit For x” - where x is the outermost loop - as soon as I match in the inner most loop. While this has always seemed to work with no ill effects, paying attention to the IDE’s memory use on Linux got me thinking - If I have a 3 depth For ... Next loo[ - for example loop variables of x, y, and z - does calling Exit For x from within the z loop cause issues with the x or y loops with regard to memory?

now sure why it would… Y and Z have a storage location… and the remains the same regardless of how you exit or bypass the loop
there should be no other resources that should “leak”

[quote=438748:@Tim Jones]Hi Folks,

A “what happens if” type question.

When using a 2 or 3 deep For ... Next loop to test for a match to an array of an array (of an array), I’ve always called “Exit For x” - where x is the outermost loop - as soon as I match in the inner most loop. While this has always seemed to work with no ill effects, paying attention to the IDE’s memory use on Linux got me thinking - If I have a 3 depth For ... Next loo[ - for example loop variables of x, y, and z - does calling Exit For x from within the z loop cause issues with the x or y loops with regard to memory?[/quote]

only thing I can think of is maybe skipping the destructor of an instance like goto does

but thats testable

I’ve just become a bit gun-shy on unexpected memory use of late. I did check a few samples and sure enough, Xojo cleaned up after itself even after 5 levels deep.

thats good …
wasnt sure if it suffered from the goto bug <https://xojo.com/issue/24710>