File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -332,7 +332,7 @@ scope and that is what [coroutineScope] function provides:
332332suspend fun concurrentSum (): Int = coroutineScope {
333333 val one = async { doSomethingUsefulOne() }
334334 val two = async { doSomethingUsefulTwo() }
335- one.await() + two.await()
335+ one.await() + two.await()
336336}
337337```
338338
@@ -350,18 +350,18 @@ import kotlinx.coroutines.*
350350import kotlin.system.*
351351
352352fun main () = runBlocking<Unit > {
353- // sampleStart
353+ // sampleStart
354354 val time = measureTimeMillis {
355355 println (" The answer is ${concurrentSum()} " )
356356 }
357357 println (" Completed in $time ms" )
358- // sampleEnd
358+ // sampleEnd
359359}
360360
361361suspend fun concurrentSum (): Int = coroutineScope {
362362 val one = async { doSomethingUsefulOne() }
363363 val two = async { doSomethingUsefulTwo() }
364- one.await() + two.await()
364+ one.await() + two.await()
365365}
366366
367367suspend fun doSomethingUsefulOne (): Int {
@@ -418,7 +418,7 @@ suspend fun failedConcurrentSum(): Int = coroutineScope {
418418 println (" Second child throws an exception" )
419419 throw ArithmeticException ()
420420 }
421- one.await() + two.await()
421+ one.await() + two.await()
422422}
423423```
424424
You can’t perform that action at this time.
0 commit comments