Sequential Execution and Iteration with Async/Await

Learn sequential execution and iteration with examples.

We'll cover the following

Our exploration of control flow patterns with async/await starts with sequential execution and iteration.

Execution

We already mentioned a few times that the core strength of async/await lies in its ability to make asynchronous serial execution easy to write and straightforward to read. This was already apparent in all the code samples we’ve written so far; however, it’ll become even more obvious now that we’ll start converting our web spider version 2. Async/await is so simple to use and understand that there are really no patterns here to study. So, let’s get straight to the code.

Let’s start with the download() function of our web spider. Here’s how it looks with async/await:

Get hands-on with 1400+ tech skills courses.