Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to return to the top of a foreach loop
Message
From
26/01/2007 12:24:59
 
 
To
22/01/2007 17:02:04
John Baird
Coatesville, Pennsylvania, United States
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01185290
Message ID:
01189711
Views:
14
I wonder if it's not just a matter of semantics - or how one thinks about it?

static void Main(string[] args)
{
int[] aryInts = new int[5] { 0, 1, 2, 3, 4 };

foreach (int j in aryInts) {
if (j == 3) {
Console.WriteLine("Three.");
}
}
foreach (int j in aryInts)
{
if (j != 3)
{
continue; //Skips to closing foreach brace then returns to top
}
Console.WriteLine("Three too!");
}

}
Previous
Reply
Map
View

Click here to load this message in the networking platform