I don't how can i do when condition done and then continue loop
(soory for incomprehensible Language xD)
In code
for(var i=0;i<10;i++)
{
if( // some condition)
{
//codee doesn't matter
}
else if ( // some condition )
{
//And NOW when code is here i want go to next repetition
}
}
When i try to use continue and break i have error
illegal break statement
return too is bad because it doesn't move to next repetition
I hope that i write this ok .. thanks!
Try this:
for(var i = 0; i < 10; i++)
{
bool isCheckrequired = // some condition from else if you mentioned;
if(!isCheckrequired)//Any code which needs to be executed comes under this condition
{
if( // some condition)
{
//codee doesn't matter
}
}
}
What i have done here first to check if anything needs to be done in particular iteration(by moving the condition you mentioned in your ifelse block to the top) and then if code needs to be executed in particular iteration then put that code into the if block.
for(var i = 0; i< 10; ++i) {
if ( /* some condition */) {
//codee doesn't matter
}
}
If you want to continue just don't do nothing and it will continue. If you really want a continue condition you could do the following:
for(var i = 0; i< 10; ++i) {
if ( /* some condition */ ) {
//codee doesn't matter
}
else if ( /* other condition */ ) {
continue;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.