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 does public mean in c#?
Are c# tuples immutable?
How do I create a multilanguage?
What do you mean by abstract class in c#?
Is inheritance possible in c sharp?
How do you prevent a method from being overridden in c#?
Why do we use anonymous method in c#?
What is c# used for in the industry?
What do you mean by casting a data type?
What is use of super class
What namespaces are necessary to create a localized application?
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,