Create a for loop without init value in CSharp
Description
The following code shows how to create a for loop without init value.
Example
/*from w ww . j a v a2 s . c o m*/
using System;
public class MainClass
{
public static void Main()
{
int counter = 0;
// some work here
counter = 3;
// more work here
for ( ; counter<10; counter++)
{
Console.WriteLine(
"counter: {0} ", counter);
}
}
}
The code above generates the following result.