# Exploring "select" expression of Kotlin coroutines

DevFeed: [Exploring "select" expression of Kotlin coroutines](<https://devfeed.tech/articles/exploring-select-expression-of-kotlin-coroutines-25719.md>)

Original publisher: [Read original article](<https://blog.shreyaspatil.dev/exploring-select-expression-of-kotlin-coroutines/>)

Author: Shreyas Patil

Published: 2022-09-27T14:29:44Z

Content type: tutorial

Language: en

Sources: [Shreyas Patil's Blog](<https://devfeed.tech/sources/shreyas-patil-s-blog.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Coroutines](<https://devfeed.tech/topics/coroutines.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [apis](<https://devfeed.tech/tags/apis.md>), [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [await](<https://devfeed.tech/tags/await.md>), [builder](<https://devfeed.tech/tags/builder.md>), [channel](<https://devfeed.tech/tags/channel.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [expression](<https://devfeed.tech/tags/expression.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-coroutines](<https://devfeed.tech/tags/kotlin-coroutines.md>), [multithreading](<https://devfeed.tech/tags/multithreading.md>), [select](<https://devfeed.tech/tags/select.md>), [type-safe](<https://devfeed.tech/tags/type-safe.md>)

## AI overview

Kotlin coroutines' `select` expression suspends while waiting on multiple clauses and proceeds with the first one selected; it can also fail if a clause fails. The excerpt illustrates using it to take the faster result from concurrent suspending functions, dismiss a dialog when either of two buttons is clicked, and choose values produced by channels. In the channel example, odd values are selected more often because they are produced sooner. If multiple clauses can be selected at once, the excerpt says the first executed clause wins.

## Source excerpt

Learn how to use the 'select' expression in Kotlin Coroutines to await multiple suspending functions and select the first one that completes.