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 does public mean in c#?

0 Answers  


Are c# tuples immutable?

0 Answers  


How do I create a multilanguage?

0 Answers  


What do you mean by abstract class in c#?

0 Answers  


Is inheritance possible in c sharp?

0 Answers  


How do you prevent a method from being overridden in c#?

0 Answers  


Why do we use anonymous method in c#?

0 Answers  


What is c# used for in the industry?

0 Answers  


What do you mean by casting a data type?

0 Answers  


What is use of super class

4 Answers   NIIT,


What namespaces are necessary to create a localized application?

1 Answers  


How do you remove the objects which are not in use?Explicitly or implicitly?What is the exact mechanism going behind?

2 Answers   Advanced Software Systems, Choice Solutions,


Categories