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

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.

主站蜘蛛池模板: 黄浦区| 通榆县| 广灵县| 明光市| 和政县| 山西省| 龙泉市| 濮阳市| 北辰区| 阿拉善左旗| 哈巴河县| 星子县| 西林县| 金塔县| 道孚县| 大渡口区| 美姑县| 吉安市| 丽水市| 渭南市| 高雄市| 汝南县| 犍为县| 甘肃省| 汝州市| 疏附县| 龙山县| 溧水县| 临沧市| 佛冈县| 麦盖提县| 县级市| 石柱| 陆河县| 孟连| 涞水县| 扬州市| 峡江县| 伊川县| 通许县| 桐柏县|