Skip to content

Commit 54e22a7

Browse files
committed
Doc add a missing playground runnable comments
1 parent 52cbf01 commit 54e22a7

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

docs/topics/channels.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,7 @@ Now let's see how it works in practice:
573573
import kotlinx.coroutines.*
574574
import kotlinx.coroutines.channels.*
575575

576+
//sampleStart
576577
fun main() = runBlocking<Unit> {
577578
val tickerChannel = ticker(delayMillis = 100, initialDelayMillis = 0) // create ticker channel
578579
var nextElement = withTimeoutOrNull(1) { tickerChannel.receive() }
@@ -596,7 +597,9 @@ fun main() = runBlocking<Unit> {
596597

597598
tickerChannel.cancel() // indicate that no more elements are needed
598599
}
600+
//sampleEnd
599601
```
602+
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}
600603

601604
> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-channel-10.kt).
602605
>

docs/topics/coroutines-basics.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,14 +257,18 @@ without hitting resource limits. For example, the following code launches
257257
import kotlinx.coroutines.*
258258

259259
fun main() = runBlocking {
260+
//sampleStart
260261
repeat(100_000) { // launch a lot of coroutines
261262
launch {
262263
delay(5000L)
263264
print(".")
264265
}
265266
}
267+
//sampleEnd
266268
}
267269
```
270+
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}
271+
268272
<!-- While coroutines do have a smaller memory footprint than threads, this
269273
example will exhaust the playground's heap memory; don't make it runnable. -->
270274

docs/topics/exception-handling.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ It can be demonstrated by a simple example that creates root coroutines using th
2828
```kotlin
2929
import kotlinx.coroutines.*
3030

31+
//sampleStart
3132
@OptIn(DelicateCoroutinesApi::class)
3233
fun main() = runBlocking {
3334
val job = GlobalScope.launch { // root coroutine with launch
@@ -47,7 +48,9 @@ fun main() = runBlocking {
4748
println("Caught ArithmeticException")
4849
}
4950
}
51+
//sampleEnd
5052
```
53+
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}
5154

5255
> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-exceptions-01.kt).
5356
>

0 commit comments

Comments
 (0)