Developer concepts

What is async/await?

Keywords that let code wait for slow work without blocking everything else.

Your code asks a server for data, and the answer takes half a second. If the program just sat there waiting, the whole app would freeze.

What it is

Async and await are keywords, in JavaScript, Python, C# and more, that let code wait for slow work without blocking everything else.

How it works

You mark a function as async. Inside it, you put await in front of something slow, like a network request. The function pauses there and hands control back, so the program can do other work. When the response arrives, it picks up where it left off. The code reads top to bottom, even though it doesn't run that way.

Why it matters

One server can juggle thousands of waiting requests, and the screen never freezes. It's also far easier to read than nested callbacks.

More from The Benmore Brief on YouTube

Put AI to work in your business.

Benmore's forward deployed engineers build and connect the software, from discovery to deployment.

Talk to us