Suspending functions
Let’s look at an important concept within asynchronous programming in Kotlin. We can say that they are the cornerstone that allows us to write asynchronous code in a sequential and easy-to-understand way, revolutionizing the way we handle operations that take time.
Suspending functions are functions that can suspend their execution without blocking the thread where it is running. In other words, we can say that it is a function that can pause execution at a certain point, free the thread for other tasks, and finally resume its execution later, which is likely to happen in a different thread.
We can identify a suspend function by how it is defined. These functions have the suspend modifier, which automatically makes them a suspend function.
Let’s create an example with code:
import kotlinx.coroutines.*
// Suspendable function to take the order
suspend fun takeOrderSuspend(): String {
    delay(3000) // Simulates the preparation time...