官术网_书友最值得收藏!

The while loop

This executes the statement or code block until the condition evaluates to true. In this expression evaluates before the execution of code-block, if expression evaluates to false, loop terminates and no statement or code-block execute. Take a look at the following code snippet:

private static void WhileStatementExample() 
{ 
WriteLine("while example"); 
Write("Enter repeatitive length:"); 
int length = Convert.ToInt32(ReadLine()); 
int count = 0; 
while (count < length) 
    { 
       count++; 
       WriteLine(newstring('*', count)); 
    } 
}   

The preceding code executes the while statement repeatedly until expression evaluates to false.

主站蜘蛛池模板: 邹城市| 沙河市| 赫章县| 镇原县| 太和县| 磴口县| 邻水| 西丰县| 柏乡县| 漠河县| 大悟县| 夹江县| 甘肃省| 洛隆县| 池州市| 建德市| 新蔡县| 娱乐| 汉阴县| 开封市| 平乐县| 白城市| 措勤县| 沾化县| 宁武县| 蒲城县| 垦利县| 南投县| 九江市| 彰化县| 兴国县| 宁城县| 永福县| 新源县| 宾川县| 土默特右旗| 水城县| 长海县| 大埔县| 屯留县| 四平市|