while Loop

noun

say it: “WYLE loop” /waɪl luːp/

A loop that keeps repeating its block as long as its condition stays true.

What is while Loop in C#?

while Loop — A loop that repeats while its condition remains true.

class Counter
{
    int CountToThree()
    {
        int number = 0;

        while (number < 3)
        {
            number++;
        }

        return number;
    }
}

In a sentence

  • “A while loop keeps asking for a guess until the player gets it right.”

Level: Apprentice · More C# terms at this level

Updated

In other subjects