Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trying to understand labeled "break" with for loops

 
Brian Lugo
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers!
I am trying to understand the labeled break with for loops and I wrote a code to try out various things in terms of where the control is actually transfered to from the labeled break statements.
My conclusion is: Labeled break is only useful in the nested loop situations.
Am I correct? I need your feedback.
Also, please check out the following code. It seems that the comiler is unable to detect/catch a unreachable statement.

CTE- Stands for Compile Time Error
prt method is taken from Bruce Eckel's book.
Looking forward to your input,
If you happen to have a good resource besides the JLS for labeled break/continue statements could you please post them?
Thanks,
Brian
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in the Java tutorial there may be something useful too:
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/branch.html
HIH
 
Brian Lugo
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Valentin!
Ranchers - Any thoughts on the uncaught unreachable statement by the compiler?
Brian
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic