In Java, what is the direct method of getting out of a WHILE loop which is inside a WHILE loop and which is inside a FOR loop?
The structure should look something like this:
For{
.
.
While{
.
.
.
While{
.
.
;
}
}
}
Answer
use a label and a break
here:
while (...) {
for (...) {
if (...) break here;
}
}
see https://docs.oracle.com/javase/tutorial/java/nutsandbolts/branch.html
No comments:
Post a Comment