0
continue
When would it be a good time to use this in a program?
2 Answers
+ 2
When you do not want to do the rest of the loop before doing the entire loop another time
For example :
int a[5]={1,2,2,4,4};
int sum=0;
foreach(int i in a){
if(i%2){
continue;
}
sum+=i;
}
Sum will have the value 12 at the end as this loop sum all even numbers in a.
For me, continue should be avoided but it is only personal.
+ 2
hi bro,
below is an example.
https://code.sololearn.com/cWQ6D0b0c556/?ref=app