Can any one tell me why continue statement is not working in if ? i tried with following code

outA:
 if(userValue==randomValue)
 {
int luck=s.nextInt();
int randNo=(int)(Math.random()*(userValue*2+(1)));
int arrValue=point[i];
arrValue+=userValue;
 point[i]=arrValue;
continue outA ;
}

but it shows error

Recommended Answers

The continue statement skips the current iteration of a for, while , or do-while loop. Since yu don't have any of those, it's not a valid use of continue.
Look at the second part of this tutorial

Jump to Post

continue and break are for loops. Not for condition statements.

Jump to Post

All 6 Replies

continue and break are for loops. Not for condition statements.

@adarshcu
It's good that you are trying to contribute here. But did you read the previous post? Did your post add anything new?

@above.

Sorry. I understand. I saw your post after i posted mine. A mistake.

OK. No problem. :-)

Thanks for all your replies.. It's helpful for me...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.