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

  • Learn C# in 7 days
  • Gaurav Aroraa
  • 87字
  • 2021-07-08 09:51:29

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.

主站蜘蛛池模板: 广安市| 武川县| 三门县| 临泉县| 克东县| 深水埗区| 鄯善县| 玉溪市| 双峰县| 左权县| 新郑市| 南和县| 赤水市| 利辛县| 精河县| 茌平县| 乃东县| 惠水县| 伊川县| 冷水江市| 理塘县| 公主岭市| 奎屯市| 桐乡市| 定南县| 鱼台县| 健康| 蒙城县| 马尔康县| 边坝县| 台湾省| 若羌县| 桃园市| 青田县| 呼伦贝尔市| 长岛县| 丰顺县| 通许县| 承德县| 喜德县| 闽侯县|