Terminate the loop when quit becomes true

When the value of quit becomes true, the loop structure terminates.  (See Listing 7.)

When the loop structure terminates, the function named doLoop terminates and returns control to the function named doSomething.

At that point, the doSomething function executes a couple more action elements in the sequence and then terminates.  (See Listing 5.)