A loop is nested in the sequence

The doSomething function executes a sequence of statements and then terminates.

One of the action elements in the sequence is a loop structure, which is implemented as a function named doLoop.

Although the loop structure is implemented in a function, it could have been implemented as inline code just as well.