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

unreachable statement

 
sun par
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

gives unreachable statement at 6. is it bcos line 7 is not reached?
Thanks
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The syntax for a while statement is: while(boolean_condition) statement;
If, as in your example, boolean_condition is false, then statement is unreachable.
Beacause a block which is { statement; ... } IS a statement the message that line 6 is unreachable is correct.
Sort of...
-Barry
 
sun par
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Barry
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also check out JLS 14.20 Unreachable Statements
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic