# Converting A Coroutine To An Async

#### Preface

The original content is from the author Michael Quinn from [Medium.com](https://medium.com/unity-coder-corner/unity-converting-a-coroutine-to-an-async-and-never-looking-back-b5a78f91049f). It has been modified and updated for use in this wiki.

<p class="callout warning">This is an **advanced** topic! You should have an understanding of Object Oriented Programming in C# as well as an understanding behind C# Delegates.</p>

<p class="callout info">I could have translated the code below into code snippets, but I found it more important to physically type what's needed for the sake of understanding.</p>

#### About

Coroutines are amazing ways to sequence logic together over many frames. Asynchronous programming, or **async**, allows the code to similarly be split over multiple frames, but allows for multithreading which has the benefit of logic being concurrently executed instead of sequentially.

####  

#### The Coroutine Way

I have a very simple example that rotates cubes for a certain amount of time.

<div class="go gp ga gq gr" id="bkmrk-"><div class="ab ca"><div class="ch bg eu ev ew ex"><figure class="ow ox oy oz pa pb ot ou paragraph-image"><div class="ot ou ov"><picture><source sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 617px" srcset="https://miro.medium.com/v2/resize:fit:640/format:webp/1*exq_SLtABn5DvSMw9SMXVQ.png 640w, https://miro.medium.com/v2/resize:fit:720/format:webp/1*exq_SLtABn5DvSMw9SMXVQ.png 720w, https://miro.medium.com/v2/resize:fit:750/format:webp/1*exq_SLtABn5DvSMw9SMXVQ.png 750w, https://miro.medium.com/v2/resize:fit:786/format:webp/1*exq_SLtABn5DvSMw9SMXVQ.png 786w, https://miro.medium.com/v2/resize:fit:828/format:webp/1*exq_SLtABn5DvSMw9SMXVQ.png 828w, https://miro.medium.com/v2/resize:fit:1100/format:webp/1*exq_SLtABn5DvSMw9SMXVQ.png 1100w, https://miro.medium.com/v2/resize:fit:1234/format:webp/1*exq_SLtABn5DvSMw9SMXVQ.png 1234w" type="image/webp"><source data-testid="og" sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 617px" srcset="https://miro.medium.com/v2/resize:fit:640/1*exq_SLtABn5DvSMw9SMXVQ.png 640w, https://miro.medium.com/v2/resize:fit:720/1*exq_SLtABn5DvSMw9SMXVQ.png 720w, https://miro.medium.com/v2/resize:fit:750/1*exq_SLtABn5DvSMw9SMXVQ.png 750w, https://miro.medium.com/v2/resize:fit:786/1*exq_SLtABn5DvSMw9SMXVQ.png 786w, https://miro.medium.com/v2/resize:fit:828/1*exq_SLtABn5DvSMw9SMXVQ.png 828w, https://miro.medium.com/v2/resize:fit:1100/1*exq_SLtABn5DvSMw9SMXVQ.png 1100w, https://miro.medium.com/v2/resize:fit:1234/1*exq_SLtABn5DvSMw9SMXVQ.png 1234w">![](https://miro.medium.com/v2/resize:fit:617/1*exq_SLtABn5DvSMw9SMXVQ.png)</source></source></picture></div></figure></div></div></div>This script will do a loop over all the cubes and trigger a coroutine that will rotate them. Setting this function to run when a button is pressed and we have the following effect.

<div class="go gp ga gq gr" id="bkmrk--1"><div class="ab ca"><div class="ch bg eu ev ew ex"><figure class="ow ox oy oz pa pb ot ou paragraph-image"><div class="pe pf ec pg bg ph" role="button" tabindex="0"><div class="ot ou pd"><picture><source sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px" srcset="https://miro.medium.com/v2/resize:fit:640/format:webp/1*guoYuI-JBiMKQ3nZKJqPzw.gif 640w, https://miro.medium.com/v2/resize:fit:720/format:webp/1*guoYuI-JBiMKQ3nZKJqPzw.gif 720w, https://miro.medium.com/v2/resize:fit:750/format:webp/1*guoYuI-JBiMKQ3nZKJqPzw.gif 750w, https://miro.medium.com/v2/resize:fit:786/format:webp/1*guoYuI-JBiMKQ3nZKJqPzw.gif 786w, https://miro.medium.com/v2/resize:fit:828/format:webp/1*guoYuI-JBiMKQ3nZKJqPzw.gif 828w, https://miro.medium.com/v2/resize:fit:1100/format:webp/1*guoYuI-JBiMKQ3nZKJqPzw.gif 1100w, https://miro.medium.com/v2/resize:fit:1400/format:webp/1*guoYuI-JBiMKQ3nZKJqPzw.gif 1400w" type="image/webp"><source data-testid="og" sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px" srcset="https://miro.medium.com/v2/resize:fit:640/1*guoYuI-JBiMKQ3nZKJqPzw.gif 640w, https://miro.medium.com/v2/resize:fit:720/1*guoYuI-JBiMKQ3nZKJqPzw.gif 720w, https://miro.medium.com/v2/resize:fit:750/1*guoYuI-JBiMKQ3nZKJqPzw.gif 750w, https://miro.medium.com/v2/resize:fit:786/1*guoYuI-JBiMKQ3nZKJqPzw.gif 786w, https://miro.medium.com/v2/resize:fit:828/1*guoYuI-JBiMKQ3nZKJqPzw.gif 828w, https://miro.medium.com/v2/resize:fit:1100/1*guoYuI-JBiMKQ3nZKJqPzw.gif 1100w, https://miro.medium.com/v2/resize:fit:1400/1*guoYuI-JBiMKQ3nZKJqPzw.gif 1400w">![](https://miro.medium.com/v2/resize:fit:700/1*guoYuI-JBiMKQ3nZKJqPzw.gif)</source></source></picture></div></div></figure></div></div></div>####  

#### The Async Way

To convert the current method we are going to swap **IEnumerator** to **async** and then change the *yield* to an *await task*.

<div class="go gp ga gq gr" id="bkmrk--2"><div class="ab ca"><div class="ch bg eu ev ew ex"><figure class="ow ox oy oz pa pb ot ou paragraph-image"><div class="ot ou pj"><picture><source sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 595px" srcset="https://miro.medium.com/v2/resize:fit:640/format:webp/1*08xKFYuSP50WZJ2eKjh44Q.gif 640w, https://miro.medium.com/v2/resize:fit:720/format:webp/1*08xKFYuSP50WZJ2eKjh44Q.gif 720w, https://miro.medium.com/v2/resize:fit:750/format:webp/1*08xKFYuSP50WZJ2eKjh44Q.gif 750w, https://miro.medium.com/v2/resize:fit:786/format:webp/1*08xKFYuSP50WZJ2eKjh44Q.gif 786w, https://miro.medium.com/v2/resize:fit:828/format:webp/1*08xKFYuSP50WZJ2eKjh44Q.gif 828w, https://miro.medium.com/v2/resize:fit:1100/format:webp/1*08xKFYuSP50WZJ2eKjh44Q.gif 1100w, https://miro.medium.com/v2/resize:fit:1190/format:webp/1*08xKFYuSP50WZJ2eKjh44Q.gif 1190w" type="image/webp"><source data-testid="og" sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 595px" srcset="https://miro.medium.com/v2/resize:fit:640/1*08xKFYuSP50WZJ2eKjh44Q.gif 640w, https://miro.medium.com/v2/resize:fit:720/1*08xKFYuSP50WZJ2eKjh44Q.gif 720w, https://miro.medium.com/v2/resize:fit:750/1*08xKFYuSP50WZJ2eKjh44Q.gif 750w, https://miro.medium.com/v2/resize:fit:786/1*08xKFYuSP50WZJ2eKjh44Q.gif 786w, https://miro.medium.com/v2/resize:fit:828/1*08xKFYuSP50WZJ2eKjh44Q.gif 828w, https://miro.medium.com/v2/resize:fit:1100/1*08xKFYuSP50WZJ2eKjh44Q.gif 1100w, https://miro.medium.com/v2/resize:fit:1190/1*08xKFYuSP50WZJ2eKjh44Q.gif 1190w">![](https://miro.medium.com/v2/resize:fit:595/1*08xKFYuSP50WZJ2eKjh44Q.gif)</source></source></picture></div></figure></div></div></div>With the proper using statement, we can simplify the naming and finish with the following code.

<div class="go gp ga gq gr" id="bkmrk--3"><div class="ab ca"><div class="ch bg eu ev ew ex"><figure class="ow ox oy oz pa pb ot ou paragraph-image"><div class="ot ou pk"><picture><source sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 625px" srcset="https://miro.medium.com/v2/resize:fit:640/format:webp/1*QzM1THui6JsoXC-8ATAgGg.png 640w, https://miro.medium.com/v2/resize:fit:720/format:webp/1*QzM1THui6JsoXC-8ATAgGg.png 720w, https://miro.medium.com/v2/resize:fit:750/format:webp/1*QzM1THui6JsoXC-8ATAgGg.png 750w, https://miro.medium.com/v2/resize:fit:786/format:webp/1*QzM1THui6JsoXC-8ATAgGg.png 786w, https://miro.medium.com/v2/resize:fit:828/format:webp/1*QzM1THui6JsoXC-8ATAgGg.png 828w, https://miro.medium.com/v2/resize:fit:1100/format:webp/1*QzM1THui6JsoXC-8ATAgGg.png 1100w, https://miro.medium.com/v2/resize:fit:1250/format:webp/1*QzM1THui6JsoXC-8ATAgGg.png 1250w" type="image/webp"><source data-testid="og" sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 625px" srcset="https://miro.medium.com/v2/resize:fit:640/1*QzM1THui6JsoXC-8ATAgGg.png 640w, https://miro.medium.com/v2/resize:fit:720/1*QzM1THui6JsoXC-8ATAgGg.png 720w, https://miro.medium.com/v2/resize:fit:750/1*QzM1THui6JsoXC-8ATAgGg.png 750w, https://miro.medium.com/v2/resize:fit:786/1*QzM1THui6JsoXC-8ATAgGg.png 786w, https://miro.medium.com/v2/resize:fit:828/1*QzM1THui6JsoXC-8ATAgGg.png 828w, https://miro.medium.com/v2/resize:fit:1100/1*QzM1THui6JsoXC-8ATAgGg.png 1100w, https://miro.medium.com/v2/resize:fit:1250/1*QzM1THui6JsoXC-8ATAgGg.png 1250w">![](https://miro.medium.com/v2/resize:fit:625/1*QzM1THui6JsoXC-8ATAgGg.png)</source></source></picture></div></figure></div></div></div>Get ready for the results! They are … exactly the same.

<div class="go gp ga gq gr" id="bkmrk--4"><div class="ab ca"><div class="ch bg eu ev ew ex"><figure class="ow ox oy oz pa pb ot ou paragraph-image"><div class="ot ou pl"><picture><source sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 647px" srcset="https://miro.medium.com/v2/resize:fit:640/format:webp/1*erVojNXBzHzxLjm9pH3ZiA.gif 640w, https://miro.medium.com/v2/resize:fit:720/format:webp/1*erVojNXBzHzxLjm9pH3ZiA.gif 720w, https://miro.medium.com/v2/resize:fit:750/format:webp/1*erVojNXBzHzxLjm9pH3ZiA.gif 750w, https://miro.medium.com/v2/resize:fit:786/format:webp/1*erVojNXBzHzxLjm9pH3ZiA.gif 786w, https://miro.medium.com/v2/resize:fit:828/format:webp/1*erVojNXBzHzxLjm9pH3ZiA.gif 828w, https://miro.medium.com/v2/resize:fit:1100/format:webp/1*erVojNXBzHzxLjm9pH3ZiA.gif 1100w, https://miro.medium.com/v2/resize:fit:1294/format:webp/1*erVojNXBzHzxLjm9pH3ZiA.gif 1294w" type="image/webp"><source data-testid="og" sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 647px" srcset="https://miro.medium.com/v2/resize:fit:640/1*erVojNXBzHzxLjm9pH3ZiA.gif 640w, https://miro.medium.com/v2/resize:fit:720/1*erVojNXBzHzxLjm9pH3ZiA.gif 720w, https://miro.medium.com/v2/resize:fit:750/1*erVojNXBzHzxLjm9pH3ZiA.gif 750w, https://miro.medium.com/v2/resize:fit:786/1*erVojNXBzHzxLjm9pH3ZiA.gif 786w, https://miro.medium.com/v2/resize:fit:828/1*erVojNXBzHzxLjm9pH3ZiA.gif 828w, https://miro.medium.com/v2/resize:fit:1100/1*erVojNXBzHzxLjm9pH3ZiA.gif 1100w, https://miro.medium.com/v2/resize:fit:1294/1*erVojNXBzHzxLjm9pH3ZiA.gif 1294w">![](https://miro.medium.com/v2/resize:fit:647/1*erVojNXBzHzxLjm9pH3ZiA.gif)</source></source></picture></div></figure></div></div></div><div class="ab ca pm pn po pp" id="bkmrk--5" role="separator">  
</div>Okay so where is the power in this? The benefits are immense. The very first we may be able to see was that I had to add a return type when converting the function from a coroutine to an async method. Coroutines don’t return values like that.

To get around this shortcoming, I’ve had to do crazy things like this before.

<div class="go gp ga gq gr" id="bkmrk--6"><div class="ab ca"><div class="ch bg eu ev ew ex"><figure class="ow ox oy oz pa pb ot ou paragraph-image"><div class="pe pf ec pg bg ph" role="button" tabindex="0"><div class="ot ou pu"><picture><source sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px" srcset="https://miro.medium.com/v2/resize:fit:640/format:webp/1*cV-zdIf0EfkUs0bSInHchw.png 640w, https://miro.medium.com/v2/resize:fit:720/format:webp/1*cV-zdIf0EfkUs0bSInHchw.png 720w, https://miro.medium.com/v2/resize:fit:750/format:webp/1*cV-zdIf0EfkUs0bSInHchw.png 750w, https://miro.medium.com/v2/resize:fit:786/format:webp/1*cV-zdIf0EfkUs0bSInHchw.png 786w, https://miro.medium.com/v2/resize:fit:828/format:webp/1*cV-zdIf0EfkUs0bSInHchw.png 828w, https://miro.medium.com/v2/resize:fit:1100/format:webp/1*cV-zdIf0EfkUs0bSInHchw.png 1100w, https://miro.medium.com/v2/resize:fit:1400/format:webp/1*cV-zdIf0EfkUs0bSInHchw.png 1400w" type="image/webp"><source data-testid="og" sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px" srcset="https://miro.medium.com/v2/resize:fit:640/1*cV-zdIf0EfkUs0bSInHchw.png 640w, https://miro.medium.com/v2/resize:fit:720/1*cV-zdIf0EfkUs0bSInHchw.png 720w, https://miro.medium.com/v2/resize:fit:750/1*cV-zdIf0EfkUs0bSInHchw.png 750w, https://miro.medium.com/v2/resize:fit:786/1*cV-zdIf0EfkUs0bSInHchw.png 786w, https://miro.medium.com/v2/resize:fit:828/1*cV-zdIf0EfkUs0bSInHchw.png 828w, https://miro.medium.com/v2/resize:fit:1100/1*cV-zdIf0EfkUs0bSInHchw.png 1100w, https://miro.medium.com/v2/resize:fit:1400/1*cV-zdIf0EfkUs0bSInHchw.png 1400w">![](https://miro.medium.com/v2/resize:fit:700/1*cV-zdIf0EfkUs0bSInHchw.png)</source></source></picture></div></div></figure></div></div></div>Ugh, yuck. Who wants to read that? With async, everything is far more readable and easier when it comes to return values.

The strongest immediate benefit of async is the power of multithreading. Coroutines run on what is called the **main thread**. The longer it takes the main thread to move, the more lag your application will experience. Async, however, can run on threads besides the main thread. This benefit from async can give a major benefit to an applications performance.

Multithreading is not totally noticeable in this example, but this next benefit is. Async has the ability to run sequentially using the keyword **await**.

But if Coroutines are made for sequential logic, then how is this a benefit? Coroutines *are* made for sequential logic, but they are not made for sequentially executing coroutines.

Now, there are ways to sequentially execute coroutines. The absolute simplest way would be to have a **StartCoroutine()** function at the end of a coroutine. This chaining however, will lead to very difficult code to unpick when it comes time to refactor. A cleaner way to handle this with async methods is using **await.**

Our first step is to change the return type, from **void** to **Task**. Then we can use the await functionality by making the original function also async.

<div class="go gp ga gq gr" id="bkmrk--7"><div class="ab ca"><div class="ch bg eu ev ew ex"><figure class="ow ox oy oz pa pb ot ou paragraph-image"><div class="pe pf ec pg bg ph" role="button" tabindex="0"><div class="ot ou pv"><picture><source sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 630px" srcset="https://miro.medium.com/v2/resize:fit:640/format:webp/1*raFOqRx98mCE9DqDC_cymQ.gif 640w, https://miro.medium.com/v2/resize:fit:720/format:webp/1*raFOqRx98mCE9DqDC_cymQ.gif 720w, https://miro.medium.com/v2/resize:fit:750/format:webp/1*raFOqRx98mCE9DqDC_cymQ.gif 750w, https://miro.medium.com/v2/resize:fit:786/format:webp/1*raFOqRx98mCE9DqDC_cymQ.gif 786w, https://miro.medium.com/v2/resize:fit:828/format:webp/1*raFOqRx98mCE9DqDC_cymQ.gif 828w, https://miro.medium.com/v2/resize:fit:1100/format:webp/1*raFOqRx98mCE9DqDC_cymQ.gif 1100w, https://miro.medium.com/v2/resize:fit:1260/format:webp/1*raFOqRx98mCE9DqDC_cymQ.gif 1260w" type="image/webp"><source data-testid="og" sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 630px" srcset="https://miro.medium.com/v2/resize:fit:640/1*raFOqRx98mCE9DqDC_cymQ.gif 640w, https://miro.medium.com/v2/resize:fit:720/1*raFOqRx98mCE9DqDC_cymQ.gif 720w, https://miro.medium.com/v2/resize:fit:750/1*raFOqRx98mCE9DqDC_cymQ.gif 750w, https://miro.medium.com/v2/resize:fit:786/1*raFOqRx98mCE9DqDC_cymQ.gif 786w, https://miro.medium.com/v2/resize:fit:828/1*raFOqRx98mCE9DqDC_cymQ.gif 828w, https://miro.medium.com/v2/resize:fit:1100/1*raFOqRx98mCE9DqDC_cymQ.gif 1100w, https://miro.medium.com/v2/resize:fit:1260/1*raFOqRx98mCE9DqDC_cymQ.gif 1260w">![](https://miro.medium.com/v2/resize:fit:630/1*raFOqRx98mCE9DqDC_cymQ.gif)</source></source></picture></div></div></figure></div></div></div>Now when we test this logic, we will see the cubes only rotate after the one before it is finished.

<div class="go gp ga gq gr" id="bkmrk--8"><div class="ab ca"><div class="ch bg eu ev ew ex"><figure class="ow ox oy oz pa pb ot ou paragraph-image"><div class="ot ou pw"><picture><source sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 688px" srcset="https://miro.medium.com/v2/resize:fit:640/format:webp/1*jYW2yjojQMcrJVfQU1fqpw.gif 640w, https://miro.medium.com/v2/resize:fit:720/format:webp/1*jYW2yjojQMcrJVfQU1fqpw.gif 720w, https://miro.medium.com/v2/resize:fit:750/format:webp/1*jYW2yjojQMcrJVfQU1fqpw.gif 750w, https://miro.medium.com/v2/resize:fit:786/format:webp/1*jYW2yjojQMcrJVfQU1fqpw.gif 786w, https://miro.medium.com/v2/resize:fit:828/format:webp/1*jYW2yjojQMcrJVfQU1fqpw.gif 828w, https://miro.medium.com/v2/resize:fit:1100/format:webp/1*jYW2yjojQMcrJVfQU1fqpw.gif 1100w, https://miro.medium.com/v2/resize:fit:1376/format:webp/1*jYW2yjojQMcrJVfQU1fqpw.gif 1376w" type="image/webp"><source data-testid="og" sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 688px" srcset="https://miro.medium.com/v2/resize:fit:640/1*jYW2yjojQMcrJVfQU1fqpw.gif 640w, https://miro.medium.com/v2/resize:fit:720/1*jYW2yjojQMcrJVfQU1fqpw.gif 720w, https://miro.medium.com/v2/resize:fit:750/1*jYW2yjojQMcrJVfQU1fqpw.gif 750w, https://miro.medium.com/v2/resize:fit:786/1*jYW2yjojQMcrJVfQU1fqpw.gif 786w, https://miro.medium.com/v2/resize:fit:828/1*jYW2yjojQMcrJVfQU1fqpw.gif 828w, https://miro.medium.com/v2/resize:fit:1100/1*jYW2yjojQMcrJVfQU1fqpw.gif 1100w, https://miro.medium.com/v2/resize:fit:1376/1*jYW2yjojQMcrJVfQU1fqpw.gif 1376w">![](https://miro.medium.com/v2/resize:fit:688/1*jYW2yjojQMcrJVfQU1fqpw.gif)</source></source></picture></div></figure></div></div></div>Another benefit, that might convince you to never use coroutines again, is that with async, you can make logic wait until a series of tasks have completed.

To demonstrate this, I’m going to create a simple array of colors, then have the button change ONLY after all the cubes have finished moving.

<div class="go gp ga gq gr" id="bkmrk--9"><div class="ab ca"><div class="ch bg eu ev ew ex"><figure class="ow ox oy oz pa pb ot ou paragraph-image"><div class="ot ou px"><picture><source sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 620px" srcset="https://miro.medium.com/v2/resize:fit:640/format:webp/1*c7Ri-gF9HpPNsI4bh5kfiQ.png 640w, https://miro.medium.com/v2/resize:fit:720/format:webp/1*c7Ri-gF9HpPNsI4bh5kfiQ.png 720w, https://miro.medium.com/v2/resize:fit:750/format:webp/1*c7Ri-gF9HpPNsI4bh5kfiQ.png 750w, https://miro.medium.com/v2/resize:fit:786/format:webp/1*c7Ri-gF9HpPNsI4bh5kfiQ.png 786w, https://miro.medium.com/v2/resize:fit:828/format:webp/1*c7Ri-gF9HpPNsI4bh5kfiQ.png 828w, https://miro.medium.com/v2/resize:fit:1100/format:webp/1*c7Ri-gF9HpPNsI4bh5kfiQ.png 1100w, https://miro.medium.com/v2/resize:fit:1240/format:webp/1*c7Ri-gF9HpPNsI4bh5kfiQ.png 1240w" type="image/webp"><source data-testid="og" sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 620px" srcset="https://miro.medium.com/v2/resize:fit:640/1*c7Ri-gF9HpPNsI4bh5kfiQ.png 640w, https://miro.medium.com/v2/resize:fit:720/1*c7Ri-gF9HpPNsI4bh5kfiQ.png 720w, https://miro.medium.com/v2/resize:fit:750/1*c7Ri-gF9HpPNsI4bh5kfiQ.png 750w, https://miro.medium.com/v2/resize:fit:786/1*c7Ri-gF9HpPNsI4bh5kfiQ.png 786w, https://miro.medium.com/v2/resize:fit:828/1*c7Ri-gF9HpPNsI4bh5kfiQ.png 828w, https://miro.medium.com/v2/resize:fit:1100/1*c7Ri-gF9HpPNsI4bh5kfiQ.png 1100w, https://miro.medium.com/v2/resize:fit:1240/1*c7Ri-gF9HpPNsI4bh5kfiQ.png 1240w">![](https://miro.medium.com/v2/resize:fit:620/1*c7Ri-gF9HpPNsI4bh5kfiQ.png)</source></source></picture></div></figure></div></div></div>Before we change this logic, let’s see what we have currently.

<div class="go gp ga gq gr" id="bkmrk--10"><div class="ab ca"><div class="ch bg eu ev ew ex"><figure class="ow ox oy oz pa pb ot ou paragraph-image"><div class="ot ou py"><picture><source sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 697px" srcset="https://miro.medium.com/v2/resize:fit:640/format:webp/1*pJbPIMz1s0MS_AMQj-LBwQ.gif 640w, https://miro.medium.com/v2/resize:fit:720/format:webp/1*pJbPIMz1s0MS_AMQj-LBwQ.gif 720w, https://miro.medium.com/v2/resize:fit:750/format:webp/1*pJbPIMz1s0MS_AMQj-LBwQ.gif 750w, https://miro.medium.com/v2/resize:fit:786/format:webp/1*pJbPIMz1s0MS_AMQj-LBwQ.gif 786w, https://miro.medium.com/v2/resize:fit:828/format:webp/1*pJbPIMz1s0MS_AMQj-LBwQ.gif 828w, https://miro.medium.com/v2/resize:fit:1100/format:webp/1*pJbPIMz1s0MS_AMQj-LBwQ.gif 1100w, https://miro.medium.com/v2/resize:fit:1394/format:webp/1*pJbPIMz1s0MS_AMQj-LBwQ.gif 1394w" type="image/webp"><source data-testid="og" sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 697px" srcset="https://miro.medium.com/v2/resize:fit:640/1*pJbPIMz1s0MS_AMQj-LBwQ.gif 640w, https://miro.medium.com/v2/resize:fit:720/1*pJbPIMz1s0MS_AMQj-LBwQ.gif 720w, https://miro.medium.com/v2/resize:fit:750/1*pJbPIMz1s0MS_AMQj-LBwQ.gif 750w, https://miro.medium.com/v2/resize:fit:786/1*pJbPIMz1s0MS_AMQj-LBwQ.gif 786w, https://miro.medium.com/v2/resize:fit:828/1*pJbPIMz1s0MS_AMQj-LBwQ.gif 828w, https://miro.medium.com/v2/resize:fit:1100/1*pJbPIMz1s0MS_AMQj-LBwQ.gif 1100w, https://miro.medium.com/v2/resize:fit:1394/1*pJbPIMz1s0MS_AMQj-LBwQ.gif 1394w">![](https://miro.medium.com/v2/resize:fit:697/1*pJbPIMz1s0MS_AMQj-LBwQ.gif)</source></source></picture></div></figure></div></div></div>Okay, so now with async, we will be able to change the behavior around so that all the cubes will rotate at the same time, but the button will still only change after they are all finished.

We are going to want to create a list of tasks that we can add to, then check to see if all those tasks have finished before changing the color of the button.

<div class="go gp ga gq gr" id="bkmrk--11"><div class="ab ca"><div class="ch bg eu ev ew ex"><figure class="ow ox oy oz pa pb ot ou paragraph-image"><div class="ot ou pz"><picture><source sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 611px" srcset="https://miro.medium.com/v2/resize:fit:640/format:webp/1*XbPp4x9-9RjKBltlRG1QRQ.gif 640w, https://miro.medium.com/v2/resize:fit:720/format:webp/1*XbPp4x9-9RjKBltlRG1QRQ.gif 720w, https://miro.medium.com/v2/resize:fit:750/format:webp/1*XbPp4x9-9RjKBltlRG1QRQ.gif 750w, https://miro.medium.com/v2/resize:fit:786/format:webp/1*XbPp4x9-9RjKBltlRG1QRQ.gif 786w, https://miro.medium.com/v2/resize:fit:828/format:webp/1*XbPp4x9-9RjKBltlRG1QRQ.gif 828w, https://miro.medium.com/v2/resize:fit:1100/format:webp/1*XbPp4x9-9RjKBltlRG1QRQ.gif 1100w, https://miro.medium.com/v2/resize:fit:1222/format:webp/1*XbPp4x9-9RjKBltlRG1QRQ.gif 1222w" type="image/webp"><source data-testid="og" sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 611px" srcset="https://miro.medium.com/v2/resize:fit:640/1*XbPp4x9-9RjKBltlRG1QRQ.gif 640w, https://miro.medium.com/v2/resize:fit:720/1*XbPp4x9-9RjKBltlRG1QRQ.gif 720w, https://miro.medium.com/v2/resize:fit:750/1*XbPp4x9-9RjKBltlRG1QRQ.gif 750w, https://miro.medium.com/v2/resize:fit:786/1*XbPp4x9-9RjKBltlRG1QRQ.gif 786w, https://miro.medium.com/v2/resize:fit:828/1*XbPp4x9-9RjKBltlRG1QRQ.gif 828w, https://miro.medium.com/v2/resize:fit:1100/1*XbPp4x9-9RjKBltlRG1QRQ.gif 1100w, https://miro.medium.com/v2/resize:fit:1222/1*XbPp4x9-9RjKBltlRG1QRQ.gif 1222w">![](https://miro.medium.com/v2/resize:fit:611/1*XbPp4x9-9RjKBltlRG1QRQ.gif)</source></source></picture></div></figure></div></div></div>The entire code will now look like the following.

<div class="go gp ga gq gr" id="bkmrk--12"><div class="ab ca"><div class="ch bg eu ev ew ex"><figure class="ow ox oy oz pa pb ot ou paragraph-image"><div class="ot ou qa"><picture><source sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 626px" srcset="https://miro.medium.com/v2/resize:fit:640/format:webp/1*09BV8dI5XNttiW7kOLfVJA.png 640w, https://miro.medium.com/v2/resize:fit:720/format:webp/1*09BV8dI5XNttiW7kOLfVJA.png 720w, https://miro.medium.com/v2/resize:fit:750/format:webp/1*09BV8dI5XNttiW7kOLfVJA.png 750w, https://miro.medium.com/v2/resize:fit:786/format:webp/1*09BV8dI5XNttiW7kOLfVJA.png 786w, https://miro.medium.com/v2/resize:fit:828/format:webp/1*09BV8dI5XNttiW7kOLfVJA.png 828w, https://miro.medium.com/v2/resize:fit:1100/format:webp/1*09BV8dI5XNttiW7kOLfVJA.png 1100w, https://miro.medium.com/v2/resize:fit:1252/format:webp/1*09BV8dI5XNttiW7kOLfVJA.png 1252w" type="image/webp"><source data-testid="og" sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 626px" srcset="https://miro.medium.com/v2/resize:fit:640/1*09BV8dI5XNttiW7kOLfVJA.png 640w, https://miro.medium.com/v2/resize:fit:720/1*09BV8dI5XNttiW7kOLfVJA.png 720w, https://miro.medium.com/v2/resize:fit:750/1*09BV8dI5XNttiW7kOLfVJA.png 750w, https://miro.medium.com/v2/resize:fit:786/1*09BV8dI5XNttiW7kOLfVJA.png 786w, https://miro.medium.com/v2/resize:fit:828/1*09BV8dI5XNttiW7kOLfVJA.png 828w, https://miro.medium.com/v2/resize:fit:1100/1*09BV8dI5XNttiW7kOLfVJA.png 1100w, https://miro.medium.com/v2/resize:fit:1252/1*09BV8dI5XNttiW7kOLfVJA.png 1252w">![](https://miro.medium.com/v2/resize:fit:626/1*09BV8dI5XNttiW7kOLfVJA.png)</source></source></picture></div></figure><figure class="ow ox oy oz pa pb ot ou paragraph-image"><div class="ot ou qb"><picture><source sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 693px" srcset="https://miro.medium.com/v2/resize:fit:640/format:webp/1*zEShllR9XEwX_JTWqtBh8Q.gif 640w, https://miro.medium.com/v2/resize:fit:720/format:webp/1*zEShllR9XEwX_JTWqtBh8Q.gif 720w, https://miro.medium.com/v2/resize:fit:750/format:webp/1*zEShllR9XEwX_JTWqtBh8Q.gif 750w, https://miro.medium.com/v2/resize:fit:786/format:webp/1*zEShllR9XEwX_JTWqtBh8Q.gif 786w, https://miro.medium.com/v2/resize:fit:828/format:webp/1*zEShllR9XEwX_JTWqtBh8Q.gif 828w, https://miro.medium.com/v2/resize:fit:1100/format:webp/1*zEShllR9XEwX_JTWqtBh8Q.gif 1100w, https://miro.medium.com/v2/resize:fit:1386/format:webp/1*zEShllR9XEwX_JTWqtBh8Q.gif 1386w" type="image/webp"><source data-testid="og" sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 693px" srcset="https://miro.medium.com/v2/resize:fit:640/1*zEShllR9XEwX_JTWqtBh8Q.gif 640w, https://miro.medium.com/v2/resize:fit:720/1*zEShllR9XEwX_JTWqtBh8Q.gif 720w, https://miro.medium.com/v2/resize:fit:750/1*zEShllR9XEwX_JTWqtBh8Q.gif 750w, https://miro.medium.com/v2/resize:fit:786/1*zEShllR9XEwX_JTWqtBh8Q.gif 786w, https://miro.medium.com/v2/resize:fit:828/1*zEShllR9XEwX_JTWqtBh8Q.gif 828w, https://miro.medium.com/v2/resize:fit:1100/1*zEShllR9XEwX_JTWqtBh8Q.gif 1100w, https://miro.medium.com/v2/resize:fit:1386/1*zEShllR9XEwX_JTWqtBh8Q.gif 1386w">![](https://miro.medium.com/v2/resize:fit:693/1*zEShllR9XEwX_JTWqtBh8Q.gif)</source></source></picture></div></figure></div></div></div>That’s pretty cool right there.

<div class="ab ca pm pn po pp" id="bkmrk--13" role="separator">  
</div>#### Takeaway

This article has only scratched the surface of the power of asynchronous programming but it has definitely convinced me to make the switch from coroutines to async.