while loop in C#

 

1. while loop:

The test condition is given in the beginning of the loop and all statements are executed till the given Boolean condition satisfies.

when the condition becomes false, the control will be out from the while loop.

 

If the number of iterations is not fixed, it is recommended to use while loop than for loop.

 

Syntax:

while (boolean condition)

{

   loop statements

}

Examples:

1.   Basic condition.

2.   Nested while loop.

Comments

Popular posts from this blog

.NET Framework Introducton

CLR with advantages and architectures

Definition and features of C#.