```var resumePoint: Continuation<String>? = ...
# coroutines
e
Copy code
var resumePoint: Continuation<String>? = null
var hasJumpedBack = false
suspend fun test() = suspendCoroutineUninterceptedOrReturn<String> {
    resumePoint = it
    "Hello "
}

fun jumpBack() {
    if (!hasJumpedBack) {
        hasJumpedBack = true
        resumePoint?.resume("World")
    }
}
runBlocking {
    println("Starting")
    val result = test()
    println(result)
    jumpBack()
}
It had to be tested
j
But why? You could use
CompletableDeferred
for this kind of use case
e
How so? Also IDK why, it's just interesting.
j
I'm afk so it's not easy to write code, but basically
resumePoint
could be a
CompletableDeferred
that you
await
in
test()
and complete successfully in
jumpBack()
e
no because when you call .await() it will wait until it's completed before it executes jumpBack()
j
Ah ok I wasn't sure what you were trying to achieve here. I guess you were just trying to break
suspendCoroutineUninterceptedOrReturn
😆
e
Yes