The
You can also use an unlabeled
Unlabeled:
Labeled:
break
statement has two forms: labeled and unlabeled.You can also use an unlabeled
break
to terminate a for
, while
, or do-while
loopUnlabeled:
for(;;){ if(){ break; // ends this loop } }
Labeled:
outer: for(;;){ inner: for(;;){ if(){ break inner; // ends inner loop } else { break outer; // ends outer loop } } }
No comments:
Post a Comment