JVM_IR KT-48435 use Java-like counter loop when possible

This commit is contained in:
Dmitry Petrov
2021-08-30 16:05:34 +03:00
committed by TeamCityServer
parent d4c91c96d3
commit 1c1b9547c1
20 changed files with 295 additions and 26 deletions
@@ -0,0 +1,16 @@
const val N = 10
fun sumUntil6(): Int {
var sum = 0
for (i in 0..N) {
if (i == 6) break
sum += i
}
return sum
}
fun box(): String {
val test = sumUntil6()
if (test != 15) return "Failed: $test"
return "OK"
}