while Loop
The while loop repeats as long as the condition is true.
int counter = 0;while (counter < 3){ Console.WriteLine($"Count: {counter}"); counter++;}Run the Application
Section titled “Run the Application”dotnet runResult
Section titled “Result”Count: 0Count: 1Count: 2