From 50398555ad5f2860bbeb230f350eb518a515505a Mon Sep 17 00:00:00 2001 From: Ying Li Date: Fri, 28 Apr 2023 19:37:03 +0900 Subject: [PATCH] minor fix for doc and sample code (#3728) --- docs/topics/select-expression.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/topics/select-expression.md b/docs/topics/select-expression.md index 8c4866ba89..0e95ab63ea 100644 --- a/docs/topics/select-expression.md +++ b/docs/topics/select-expression.md @@ -13,23 +13,23 @@ the first one that becomes available. ## Selecting from channels -Let us have two producers of strings: `fizz` and `buzz`. The `fizz` produces "Fizz" string every 300 ms: +Let us have two producers of strings: `fizz` and `buzz`. The `fizz` produces "Fizz" string every 500 ms: ```kotlin fun CoroutineScope.fizz() = produce { - while (true) { // sends "Fizz" every 300 ms - delay(300) + while (true) { // sends "Fizz" every 500 ms + delay(500) send("Fizz") } } ``` -And the `buzz` produces "Buzz!" string every 500 ms: +And the `buzz` produces "Buzz!" string every 1000 ms: ```kotlin fun CoroutineScope.buzz() = produce { - while (true) { // sends "Buzz!" every 500 ms - delay(500) + while (true) { // sends "Buzz!" every 1000 ms + delay(1000) send("Buzz!") } } @@ -62,14 +62,14 @@ import kotlinx.coroutines.channels.* import kotlinx.coroutines.selects.* fun CoroutineScope.fizz() = produce { - while (true) { // sends "Fizz" every 300 ms + while (true) { // sends "Fizz" every 500 ms delay(500) send("Fizz") } } fun CoroutineScope.buzz() = produce { - while (true) { // sends "Buzz!" every 500 ms + while (true) { // sends "Buzz!" every 1000 ms delay(1000) send("Buzz!") }