Last active
July 20, 2019 20:57
-
-
Save LucianoPAlmeida/e13c9b424a19cc985aaa2709ee83d699 to your computer and use it in GitHub Desktop.
Kotlin 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
fun hi() = sequence { // this: SequenceScope<String> | |
yield("Hi") | |
yield(":))") | |
} | |
val words = hi() | |
for (word in words) { | |
println(word) | |
} | |
//Result: | |
// Hi | |
// :)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment