Skip to content

Commit b8c9aae

Browse files
authored
Add missing playground runnable comments (#3258)
1 parent d3a9c9d commit b8c9aae

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-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/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)