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

What is difference between out and ref in c#?

527


What is delegates and events?

470


Can I call a virtual method from a constructor/destructor?

479


What is mvc pattern in c#?

514


Explain about multithreading?

548






Can a private virtual method can be overridden?

556


What is difference between constants and readonly in c#?

482


What is int32?

485


What is parsing? How to parse a date time string?

534


How string definitions will prevent escaping on backslashes in C#?

520


What are the principles of delegation?

486


Is it not possible to store a boolean value as a variable?

445


What are delegates and why are they required?

505


Explain synchronous and asynchronous operations?

530


When a Static Constructor is called in a Class?

577