. .takeWhile { ... }.forEach { ... }, , Java for. .takeWhile { ... }, , , . , .forEach { ... } .takeWhile { ... }, , .
(. , , )
, Sequence<T>. Iterable<T>, .takeWhile { ... } , .forEach { ... } . . Iterable<T> Sequence<T>.
Sequence<T> , Java, .toSequence():
(0..5).asSequence()
.takeWhile { it < (abc[it].toInt() and 0xff) }
.forEach {
// Use `it` instead of `j`
}
while:
var j = 0
while (j < 6 && j < (abc[j] as Int and 0xff)) {
j++
}