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

  • 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.

主站蜘蛛池模板: 巴彦淖尔市| 略阳县| 靖安县| 潍坊市| 阿拉善盟| 英吉沙县| 嘉祥县| 武乡县| 津市市| 湟中县| 遂川县| 宜川县| 北票市| 宣恩县| 阳山县| 富平县| 昌黎县| 怀安县| 伽师县| 敖汉旗| 金山区| 临清市| 招远市| 辰溪县| 炉霍县| 长葛市| 宝兴县| 义马市| 读书| 镇沅| 金塔县| 永寿县| 民丰县| 永定县| 鄂托克旗| 隆化县| 枣庄市| 池州市| 洪洞县| 桐梓县| 静安区|