what is work of continue statement in C#?

Answer Posted / aditya n bokade ctrainer

continue statement skips a particular PASS of the loop.

continue statement:

--> skips all the statements mentioned after it inside a loop
--> goes to the next pass by incrementing counter variable

eg.

for (int i = 1; i <= 10; i++)
{
if (i % 2 == 0)
{
continue;
}
MessageBox.Show(i.ToString());//will be skipped when i is even
}

Is This Answer Correct ?    18 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we need static class in c#?

649


Distinguish between array and arraylist in c#?

647


How more than one version of an assembly can keep in same place?

594


To catch any possible exception What is the C# syntax written ?

615


Does c# support multiple class inheritance?

697






Why do we need ienumerable in c#?

565


What is a private class in c#?

565


In a memory when you Box and Unbox a value-type what happens?

627


What is arraylist?

601


What is Asynchronous call and how it can be implemented using delegates?

655


What is the difference between constants and read-only?

558


What is namespace explain with example?

525


Is c# and c same?

593


What is difference between ienumerable and ienumerator in c#?

603


How can we set the class to be inherited, but prevent the method from being over-ridden?

569