Where is "x=2,y=3"?
fun main() {
outer@ for (x in 0…3) {
for (y in 3 downTo 1) {
if (y == x) {
break@outer //立即跳转到标签处
}
println(“(x,y) = ($x ,$y)”)
}
}
}
Run in “
play.kotlinlang.org”, the result is
(x,y) = (0 ,3)
(x,y) = (0 ,2)
(x,y) = (0 ,1)
(x,y) = (1 ,3)
(x,y) = (1 ,2)
1 post - 1 participant
Read full topic