File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -573,6 +573,7 @@ Now let's see how it works in practice:
573573import kotlinx.coroutines.*
574574import kotlinx.coroutines.channels.*
575575
576+ // sampleStart
576577fun 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>
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ It can be demonstrated by a simple example that creates root coroutines using th
2828``` kotlin
2929import kotlinx.coroutines.*
3030
31+ // sampleStart
3132@OptIn(DelicateCoroutinesApi ::class )
3233fun 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>
You can’t perform that action at this time.
0 commit comments