Search results for 'While Loop'. 1 post(s) found.
- 2009/09/05 How to implement while loop in C# ?
A While Loop will check a condition and then continues to execute a block of code as long as the condition evaluates to a boolean value of true. Its syntax is as follows: while (<boolean expression>) { <statements> }. The statements can be any valid C# statements. The boolean expression is evaluated before any code in the following block has executed. When the boolean expression evaluates to true, the statements will execute. Once the statements have executed, control returns to the beginning of the While Loop to check the boolean expression again.
When the boolean expression evaluates to false, the While Loop statements are skipped and execution begins after the closing brace of that block of code. Before entering the loop, ensure that variables evaluated in the loop condition are set to an initial state. During execution, make sure you update variables associated with the boolean expression so that the loop will end when you want it to. Listing 4-1 shows how to implement a While Loop.
Following is the example.
Another posts included in "C#"
| How to implement switch statement in C# ? (0) | 2009/09/05 |
| How to get process id in C# like windows task manager ? (0) | 2009/10/15 |
| How to delete file ? (0) | 2009/09/04 |
| How to convert integer to text string ? (0) | 2009/09/04 |
| How to convert text string to integer ? (0) | 2009/09/04 |
| How to set an certain color as transparent color on bitmap (0) | 2009/09/03 |
| How to resize and save PNG or Jpeg Image file ? (0) | 2009/09/03 |

Prev

Rss Feed