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

How to use session under class file of APP_Code folder?

720


How can you reference current thread of the method ?

707


What are the types of parameters in c#?

716


How can we sort an array in c#?

705


What's the difference between system.string and system.text.stringbuilder classes?

736


What do you understand by the terms datareader object and dataset object?

731


What are the properties of string?

694


What is namespace c#?

668


What are custom exceptions? Why do we need them?

710


Is boxing an implicit conversion?

718


What is tryparse c#?

707


What are collections in c#?

665


Can you inherit multiple classes in c#?

704


Can abstract class have constructor?

671


Enlist some of the properties of a thread class?

694