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 multicast delegate explain with example?

0 Answers  


What are Generics?

5 Answers   TCS,


What is piller of OOPS in C#.

10 Answers  


Should I use double or float?

0 Answers  


What is the Difference between a sub and a function?

3 Answers   Wipro,






Explain polymorphism in c# with a simple example?

0 Answers  


Can non-default constructors be used with single call sao?

0 Answers  


What?s the difference between the System.Array.CopyTo() and System.Array.Clone()?

3 Answers  


define ispostback and give some examples

2 Answers  


What is console read in c#?

0 Answers  


If a method's return type is void, can you use a return keyword in the method?

0 Answers  


Write a C# program to find the Factorial of n

0 Answers  


Categories