Created
October 21, 2022 02:38
-
-
Save alokomkar/7ee3f9fdf244c96f3c5254f76bf2e1b8 to your computer and use it in GitHub Desktop.
Job in coroutines
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val job = launch { // launch a new coroutine and keep a reference to its Job | |
| delay(1000L) | |
| println("World!") | |
| } | |
| println("Hello") | |
| job.join() // wait until child coroutine completes | |
| println("Done") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment