looping in c sharp code example
Example 1: how to make a for loop in c#
for (int i = 0; i < 10; i++)
{
Console.WriteLine("Value of i: {0}", i);
}
Example 2: looping in c#
//the while loop
while (condition)
{
// code block to be executed
}
//the for loop
for (statement 1; statement 2; statement 3)
{
// code block to be executed
}
//the foreach loop
foreach (type variableName in arrayName)
{
// code block to be executed
}