• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

label continue

 
Saibabaa Pragada
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Code from whizlabs. Why am I getting compilation error "The label signal is missing" I tried to change as given below but kicked out with "continue cannot be used outside of a loop". Not sure what is happening
 
Henry Wong
author
Marshal
Pie
Posts: 20881
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The continue statement can only be used for loops -- so with a labelled continue, the label must target a loop.

Henry
 
Saibabaa Pragada
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you mean to say continue is for "for loop" and not for "if loop" ?
Henry Wong wrote:
The continue statement can only be used for loops -- so with a labelled continue, the label must target a loop.

Henry
 
Henry Wong
author
Marshal
Pie
Posts: 20881
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saibabaa Pragada wrote:Did you mean to say continue is for "for loop" and not for "if loop" ?



There is no such a thing as a "if loop". "if" statements are not loops.

Henry
 
Saibabaa Pragada
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My mistake..Thanks for correcting..Let me change my sentence..Did you mean to say continue keyword is applicable for "for loop" only and not for "if statement" ? Please advice if this statement is right.
 
Henry Wong
author
Marshal
Pie
Posts: 20881
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saibabaa Pragada wrote:My mistake..Thanks for correcting..Let me change my sentence..Did you mean to say continue keyword is applicable for "for loop" only and not for "if statement" ? Please advice if this statement is right.


The continue statement may be used for any loop. The while loop, do-while loop, and both variants of the for loop.

Henry
 
Saibabaa Pragada
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great..Thanks Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic