Dan Newton
05/12/2020, 8:07 AMStephan Schroeder
05/12/2020, 10:46 AMfalse
here:
Cancelling a coroutine will change a job's isActive flag to true.
Dan Newton
05/12/2020, 10:46 AMStephan Schroeder
05/12/2020, 11:03 AMfor (it in 0..1000) {
if (isActive) {
Thread.sleep(50)
println("I am still going..")
}
}
i'd suggest to just break the loop
for (it in 0..1000) {
if (!isActive) break
Thread.sleep(50)
println("I am still going..")
}
it saves on line, doesn't iterate over the rest of all numbers once the coroutine is canceled and doesn't indent the rest of the statement.Dan Newton
05/12/2020, 11:04 AMStephan Schroeder
05/12/2020, 11:13 AM