Using the return value from the doSelection function
As you can see in Listing 7, the return value from the doSelection function is assigned to the quit variable during each iteration.
When a true value is returned by the doSelection function and assigned to quit, the loop terminates the next time it tests the value of quit.