Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumKotlinsuspend functions usageSingle-choice MCQ

Why does calling this suspend function from a non-coroutine context fail, and what is the correct general rule it illustrates?

suspend fun fetch(): String { /* ... */ return "data" } fun regular() { val x = fetch() // compile error }