What is proper use of `break labelid`?
Fred Eisele <[email protected]>
| Newsgroups | gmane.comp.lang.groovy.user |
|---|---|
| Message-ID | <CAJGQK3P3-suAe5hKf-UExwQmZtSHKpuwP60hyOZTEsZ5akNZeA@mail.gmail.com> |
I am seeing some inconsistency in the documentation for use of breaking to
labels.
This indicates that groovy works similar to fortran, goto label.
https://groovy-lang.org/semantics.html#_labeled_statements
for (int j=0;j<i;j++) {
println "j=$j"
if (j == 5) { break exit }}exit: println "i=$i"
In other places it sounds more like java.
https://stackoverflow.com/questions/6126702/java-groovy-double-for-statement-question
outerLoop:for (...) {
for (...) {
if (...) {
break outerLoop;
}
}
}