C# For Loops
for has an initialiser, a condition and an update. Use it when you know how many times to repeat. Loops can be nested.
Example
for (int i = 1; i <= 3; i++) Console.Write(i + " ");
Console.WriteLine();
for (int r = 1; r <= 2; r++)
for (int c = 1; c <= 3; c++)
Console.Write(r * c + " ");Exercise
Count to 3.
for (int i = 0; i 3; i++)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.