Interview kitsBlog

Your dream job? Lets Git IT.
Interactive technical interview preparation platform designed for modern developers.

XGitHub

Platform

  • Categories

Resources

  • Blog
  • About the app
  • FAQ
  • Feedback

Legal

  • Privacy Policy
  • Terms of Service

© 2026 LetsGit.IT. All rights reserved.

LetsGit.IT/Categories/Kotlin
Kotlinmedium

`launch` vs `async` — what’s the difference in coroutines?

Tags
#coroutines#async#launch#deferred
Back to categoryPractice quiz

Answer

`launch` starts a coroutine for side-effects and returns a `Job`. `async` returns a `Deferred<T>` for a result and you `await()` it; both should run inside a scope (structured concurrency).

coroutineScope {
  val a = async { 1 }
  val b = async { 2 }
  val sum = a.await() + b.await()
  println(sum)
}

Advanced answer

Deep dive

  • `launch { ... }`: fire-and-forget *within a scope*; you get a `Job` to cancel/join.
  • `async { ... }`: you expect a value; you get `Deferred<T>` and should `await()` it.

Exception behavior:

  • Unhandled exceptions in `launch` cancel the parent scope.
  • Exceptions in `async` are observed when you `await()` (or when the parent awaits/cancels).

Common pitfalls

  • Starting `async` and never awaiting it (lost errors / work).
  • Blocking inside coroutines on the default dispatcher.
  • Using `GlobalScope` and leaking work beyond lifecycle.

Related questions

Kotlin
coroutineScope vs supervisorScope: how do they handle failures?
#kotlin#coroutines#supervisor
Kotlin
StateFlow vs SharedFlow: what’s the difference?
#kotlin#stateflow#sharedflow
Kotlin
Coroutine exceptions: how do they propagate and when to use `CoroutineExceptionHandler`?
#kotlin#coroutines#exceptions
Kotlin
Dispatchers in Kotlin coroutines: `Default` vs `IO` vs `Main`?
#kotlin#coroutines#dispatchers
Kotlin
Channel vs Flow - how are they different in coroutines?
#kotlin#coroutines#flow
Kotlin
Coroutine cancellation is cooperative — what does that mean in practice?
#coroutines#cancellation#isActive