Files
kotlin-fork/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/decimateEveryEvenThird.kt
T
2021-12-13 18:07:11 +03:00

12 lines
252 B
Kotlin
Vendored

// !LANGUAGE: +ContextReceivers
// WITH_STDLIB
fun List<Int>.decimateEveryEvenThird() = sequence {
var counter = 1
for (e in this@List) {
if (e % 2 == 0 && counter % 3 == 0) {
yield(e)
}
counter += 1
}
}