c16b59191b
iteration over CharSequences. CharSequences may be mutable (e.g., StringBuilder) and therefore its contents and length can change within the loop.
16 lines
316 B
Kotlin
Vendored
16 lines
316 B
Kotlin
Vendored
// KJS_WITH_FULL_RUNTIME
|
|
// WITH_RUNTIME
|
|
import kotlin.test.*
|
|
|
|
fun box(): String {
|
|
val sb = StringBuilder("1234")
|
|
val result = StringBuilder()
|
|
for (c in sb) {
|
|
sb.clear()
|
|
result.append(c)
|
|
}
|
|
assertEquals("", sb.toString())
|
|
assertEquals("1", result.toString())
|
|
|
|
return "OK"
|
|
} |