val shouldBeInt = run {
var i = 1
while(true) {
if (i > 10) return@run i
}
}
In above code piece, sholeBeInt would be Any type instead of Int
val shouldBeInt = run {
var i = 1
while(true) {
if (i > 10) return@run i
}
}
In above code piece, sholeBeInt would be Any type instead of Int
Return an int after the while loop and it will work as expected.
There is an implicit return of Unit
.