除了标题中提供的问题外,没有其他内容...
例:
for(...) {
if(...) {
if(...) {
//doing stuffs
break;
}
}
}
//does that break statement get me to this spot?
在这种情况下,它将脱离for
循环。 break
将中断循环(例如while
, do/while
, for
)和switch
语句。
是。 break
将打破for循环。 break
不会脱离if语句。
是。 因为break
对于if
语句不起作用。 因此,它将适用于遇到的下一个循环。
注意: break
用于终止循环( for
, while
或do-while
)。