Because you can use
await expressions in (mostly) every expression context, their containing asynchronous methods can be paused in the middle of complex control flow constructs, as well. For example, an
await expression may occur in the middle of a loop, requiring the method to be paused and resumed at that very point, without causing additional iterations and whatnot.
Although this seems a complex undertaking, it’s not much more complicated than the simple example with linear statement sequencing shown in the previous section. The reason is rather straightforward. At the end of the day, complex control flow structures like conditional statements, loops, and so on are nothing but branch instructions in disguise. ...