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 |
Why do we need singleton class in c#?
What is the difference between abstraction and encapsulation in c#?
How do you create partial methods?
What are STA And MTA in threading?
Define the term immutable ?
Is c# still popular?
What is extended class in c#?
How can encapsulation be achieved?
How do you type a null character?
How do you generate documentation from the C# file commented properly with a command-line compiler?
What is the difference between a class and an object c#?
How do I move from one form to another in c#?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)