LANGUAGE

while loop

Tests before each body execution and can run zero times. Ensure progress toward a false condition.

Formal Syntax & Structure

csharp syntaxcsharp
while (condition) { ... }

Working Example

Example Snippetcsharp
int n = 3; while (n > 0) { n--; }
C# & .NET Reference