The "exit loop if" is never going to exit both loops, so it is the right one to use. So I think the problem is elsewhere but hard to say with just this script.
If you step through it with the script debugger; do you see any other scripts triggered by events as you move between records and layouts?
This is one very mixed up script.
There is only one place you actually declare $x; and there you set it to 0.
At the point where you declare "do something with $x" $x does not exist.
Also, you set another variable - $variable but you never use it.
Thank you for the quick reply winmdecorte. I have the variable list open and have checked everything (granted, I completely understand that when you're proof reading your own work you'll still miss obvious things). I'll try walking through it again but honestly I've no expectation at all that the outer loop should be exiting. It should move on to the next record in the parent table and then go back to the top of the loop, enter the child table and carry on. Instead, both loops are terminating.
I think that FileMaker is working the way that you wold expect it to...but that the design of your looping logic is broken somehow.
I created a test script with two simple loops.
At the end the dialog box shows that I = 5 and J = 5. If the inner loop were exiting both loops, then the J value would only = 1.
And the better test, stepping through the loop, when the inner loop hits 'Exit...' it jumps to line 10, runs lines 10 and 11, hits 12 - which causes it to go back to line 5. So it is only exiting the inner loop. (I even tried it where line 8 was: "Exit Loop if " so it always exited, and it still correctly looped the outer loop.)
Is the script you posted actually how it is set up?
Thank you everyone for your feedback! What I typed above in the original post wasn't the original loop verbatim but a brief illustration of what I've been trying to do. Bottom line, you all unanimously confirmed for me what I was suspecting but haven't been able to find in writing: "Exit Loop If" exits ONLY one single loop and it exits only the loop you're immediately in. More aptly put, I did something boneheaded to make my loop exit everything and need to do further digging to see what it was.
I appreciate all the feedback and the time from everyone.