- Learn C# in 7 days
- Gaurav Aroraa
- 109字
- 2021-07-08 09:51:29
The do...while loop
This helps us execute a statement or a statement of block repeatedly until it evaluates the expression to false. In do...while statement, a block of statement executes first and then it checks the condition under while, which means a statement or block of statements that execute at least once.
Take a look at the following code:
private static void DoWhileStatementExample() { WriteLine("do...while example"); Write("Enter repeatitive length:"); int length = Convert.ToInt32(ReadLine()); int count = 0; do { count++; WriteLine(newstring('*',count)); } while (count < length); }
In the preceding code snippet, the statement of the do block executes until the statement of the while block evaluates to false.
推薦閱讀
- Game Programming Using Qt Beginner's Guide
- 少年輕松趣編程:用Scratch創(chuàng)作自己的小游戲
- Scratch 3游戲與人工智能編程完全自學(xué)教程
- Building Mapping Applications with QGIS
- Asynchronous Android Programming(Second Edition)
- Python編程從0到1(視頻教學(xué)版)
- Scala Data Analysis Cookbook
- Python3.5從零開始學(xué)
- OpenCV Android Programming By Example
- Java程序設(shè)計(jì)教程
- 黑莓(BlackBerry)開發(fā)從入門到精通
- Instant GLEW
- MongoDB Cookbook
- 軟硬件綜合系統(tǒng)軟件需求建模及可靠性綜合試驗(yàn)、分析、評(píng)價(jià)技術(shù)
- 網(wǎng)絡(luò)綜合布線與組網(wǎng)實(shí)戰(zhàn)指南