what is work of continue statement in C#?

Answers were Sorted based on User's Feedback



what is work of continue statement in C#?..

Answer / 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

what is work of continue statement in C#?..

Answer / prem

void main(){
int i;
for(i=1;i<10;i++)
{

console.write("prem");
continue;
c.w("hi");
}
}
It will print prem 9 times not print hi.

Is This Answer Correct ?    16 Yes 0 No

what is work of continue statement in C#?..

Answer / ramya

The continue statement passes control to the next iteration
of the enclosing iteration statement in which it appears
using System;
class ContinueTest
{
public static void Main()
{
for (int i = 1; i <= 10; i++)
{
if (i < 9)
continue;
Console.WriteLine(i);
}
}
}

o/p:
9
10

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Sharp Interview Questions

What is transparent caching with aop ?

0 Answers  


Why do we need constructors?

0 Answers  


t name of controls, which are displayed same in all browers?

1 Answers   TCS,


Compare and contrast between the System.Array.CopyTo() and Clone()?

0 Answers   Siebel,


What does m mean in decimal c#?

0 Answers  






What Are The .Net Object

2 Answers   IMB, Reliance,


what are pointer types in c#

0 Answers   Cognizant,


what is CSharp

6 Answers  


What is eager loading in c#?

0 Answers  


What do you mean by a windows process in regards to memory allocation?

0 Answers  


what is method overloading in c#?

0 Answers   Arigo Infotech,


What is the use of ienumerable?

0 Answers  


Categories