This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

confused about labled break

 
saied ims
Ranch Hand
Posts: 109
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in exam watch :
Remember, continue statements must be inside a loop; otherwise,
you�ll get a compiler error. break statements must be used inside either a loop orswitch statement. (Note: this does not apply to labeled break statements.).

in another eexam watch:
"Labeled continue and break statements must be inside the loop that
has the same label name; otherwise, the code will not compile."

HOW come??? can anybody told me any explain about the first note??
class D{

public static void main(String [] ism){
int f=0;

for2:
for(int i=0;i<5;i++){
System.out.println("ffff");}
}


void fool(){
break for2;}
}


this is wont compile sure but ,why the first exam watch wrote "Note: this does not apply to labeled break statements.)"

thanks all
[ August 16, 2006: Message edited by: saied ims ]
 
wise owen
Ranch Hand
Posts: 2023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why label statement causes compile time error?:

If a break statement has a label it must be the label of an enclosing statement.


Here is an example:
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic