Skip to content

Commit f4d7a23

Browse files
committed
Core tutorial typos and language corrected
1 parent 7cf452e commit f4d7a23

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

kotlinx-coroutines-core/src/test/kotlin/examples/tutorial-example-3.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ fun main(args: Array<String>) = runBlocking {
88
println("World!")
99
}
1010
println("Hello,")
11-
job.join() // wait until children coroutine completes
11+
job.join() // wait until child coroutine completes
1212
}

kotlinx-coroutines-core/tuturial.md renamed to kotlinx-coroutines-core/tutorial.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fun main(args: Array<String>) {
2222
Run this code:
2323

2424
```
25-
Hello!
25+
Hello,
2626
World!
2727
```
2828

@@ -60,9 +60,9 @@ fun main(args: Array<String>) = runBlocking { // start main coroutine
6060
The result is the same, but this code uses only non-blocking `delay`.
6161

6262
`runBlocking { ... }` works as an adaptor that is used here to start the top-level main coroutine.
63-
The regular code outside of `runBlocking` _blocks_, until the coroutine inside `runBlocking` works.
63+
The regular code outside of `runBlocking` _blocks_, until the coroutine inside `runBlocking` is active.
6464

65-
This is also how you write unit-test for suspending functions:
65+
This is also a way to write unit-tests for suspending functions:
6666

6767
```kotlin
6868
class MyTest {
@@ -76,7 +76,7 @@ class MyTest {
7676
## Waiting for a job
7777

7878
Delaying for a time while a _child_ coroutine is working is not a good approach. Let's explicitly
79-
wait (in a non-blocking way) until other coroutine that we have launched is complete:
79+
wait (in a non-blocking way) until the other coroutine that we have launched is complete:
8080

8181
```kotlin
8282
fun main(args: Array<String>) = runBlocking {
@@ -85,7 +85,7 @@ fun main(args: Array<String>) = runBlocking {
8585
println("World!")
8686
}
8787
println("Hello,")
88-
job.join() // wait until children coroutine completes
88+
job.join() // wait until child coroutine completes
8989
}
9090
```
9191

@@ -96,8 +96,8 @@ the child coroutine in any way. Much better.
9696

9797
## Extract function refactoring
9898

99-
Let's extract the block of code inside `launch(Here} { ... }` into a separate function. If you
100-
perform "Extract function" refactoring, you'll get a new function with `suspend` modifier.
99+
Let's extract the block of code inside `launch(Here} { ... }` into a separate function. When you
100+
perform "Extract function" refactoring on this code you get a new function with `suspend` modifier.
101101
That is your first _suspending function_. Suspending functions can be used inside coroutines
102102
just like regular functions, but their additional feature is that they can, in turn,
103103
use other suspending functions, like `delay` in this example, to _suspend_ execution of a coroutine.

0 commit comments

Comments
 (0)