- Kotlin Programming Cookbook
- Aanand Shekhar Roy Rashi Karanpuria
- 30字
- 2025-04-04 17:32:31
How to do it...
The preceding multiconditional loop can be written in Kotlin like so:
(0..9).asSequence().takeWhile {
it<numbers[it]
}.forEach
println("$it - ${data[it]}")
}
It's nice, clean, and definitely not an eyesore.