- 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.
推薦閱讀
- Programming ArcGIS 10.1 with Python Cookbook
- Learning Linux Binary Analysis
- Android NDK Beginner’s Guide
- Data Analysis with IBM SPSS Statistics
- Effective Python Penetration Testing
- 人人都懂設計模式:從生活中領悟設計模式(Python實現)
- Linux操作系統(tǒng)基礎案例教程
- Oracle從入門到精通(第5版)
- Mastering Business Intelligence with MicroStrategy
- SQL Server 入門很輕松(微課超值版)
- Drupal 8 Development Cookbook(Second Edition)
- Groovy 2 Cookbook
- PHP動態(tài)網站開發(fā)實踐教程
- 算法訓練營:海量圖解+競賽刷題(入門篇)
- Spring Boot 2+Thymeleaf企業(yè)應用實戰(zhàn)