How and when to use ‘async’ and ‘await’?

Posted by Editorial Staff | Updated on

They consist of two main keywords- async and await. async is used to make a function asynchronous. When using async and await the compiler generates a state machine in the background. Here’s an example on which I hope I can explain some of the high-level details that are going on:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers