// A basic for loop.
static void ForAndForEachLoop()
{
// Note! "i" is only visible within the scope of the for loop.
for(int i = 0; i < 4; i++)
{
Console.WriteLine("Number is: {0} ", i);
}
// "i" is not visible here.
}
All of your old C, C++, and Java tricks still hold when building a C# for statement. You can
create complex terminating conditions, build endless loops, and make use of the goto, continue,
and break keywords. I’ll assume that you will bend this iteration construct as you see fit. Consult
the .NET Framework 3.5 SDK documentation if you require further details on the C# for keyword.
Do'stlaringiz bilan baham: |