Mobile Development
Kotlin
True_false
Oct 04, 2025
Suspend functions can only be called from other suspend functions or coroutines.
Detailed Explanation
Kotlin coroutines provide asynchronous programming without blocking threads:\n\n1. Suspend Functions\n• Functions that can be paused and resumed\n• Do not block the calling thread\n• Example:\n\n\n2. Coroutine Builders\n• launch - fire and forget, returns Job\n• async - returns Deferred for results\n• runBlocking - blocks current thread\n\n3. Dispatchers\n• Dispatchers.Main - UI thread operations\n• Dispatchers.IO - I/O operations (network, files)\n• Dispatchers.Default - CPU-intensive tasks\n• Dispatchers.Unconfined - not confined to specific thread\n\n4. Example Usage\n\n\n5. Benefits\n• Lightweight - can create millions of coroutines\n• Structured concurrency prevents memory leaks\n• Built-in cancellation support\n• Exception handling\n• Sequential-looking asynchronous code
Discussion (0)
No comments yet. Be the first to share your thoughts!
Share Your Thoughts