what is work of continue statement in C#?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
What is multicast delegate explain with example?
What are Generics?
What is piller of OOPS in C#.
Should I use double or float?
What is the Difference between a sub and a function?
Explain polymorphism in c# with a simple example?
Can non-default constructors be used with single call sao?
What?s the difference between the System.Array.CopyTo() and System.Array.Clone()?
define ispostback and give some examples
What is console read in c#?
If a method's return type is void, can you use a return keyword in the method?
Write a C# program to find the Factorial of n