Skip to content

Instantly share code, notes, and snippets.

@steshaw
Created June 3, 2023 03:20
Show Gist options
  • Save steshaw/53ea79f8007e7f823a3465f247a737a2 to your computer and use it in GitHub Desktop.
Save steshaw/53ea79f8007e7f823a3465f247a737a2 to your computer and use it in GitHub Desktop.
import kotlin.sequences.*
fun main() {
val i = iterator {
for (i in 1..10) {
yield(i)
}
yield(99)
}
for (a in i) {
println(a)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment