0
Does the continue puts us out of the for loop?
I mean we get out of the loop to the beginning of it to enter again.
1 Answer
+ 3
continue skips the current iteration, so all the code within the loop which follows the continue atatement will be skipped and the loop will continue to the next iteration
for(int i=0;i<100;i++){
if(i%5==0)
continue;
Console.WriteLine(i);
}
the loop above will print all the numbers which are NOT a multiple of 5
notice there is no use in 'else' statement since 'continue' skips the following instructions and goes on to the next loop iteration.