Loops repeat a block while a counter changes.

Loops

Loops.cs
using System;

class Program
{
    static void Main()
    {
        int limit = ;
        int total = 0;

        for (int number = 1; number <= limit; number++)
        {
            total += number;
        }

        Console.WriteLine($"limit={limit}");
        Console.WriteLine($"total={total}");
    }
}
using System;

class Program
{
    static void Main()
    {
        int limit = ;
        int total = 0;

        for (int number = 1; number <= limit; number++)
        {
            total += number;
        }

        Console.WriteLine($"limit={limit}");
        Console.WriteLine($"total={total}");
    }
}
using System;

class Program
{
    static void Main()
    {
        int limit = ;
        int total = 0;

        for (int number = 1; number <= limit; number++)
        {
            total += number;
        }

        Console.WriteLine($"limit={limit}");
        Console.WriteLine($"total={total}");
    }
}
for loop A `for` loop can initialize a counter, test a condition, and update the counter after each pass.