- 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.
推薦閱讀
- Spring 5.0 By Example
- GitLab Cookbook
- Implementing Cisco Networking Solutions
- Java EE 7 Development with NetBeans 8
- PhpStorm Cookbook
- Getting Started with Greenplum for Big Data Analytics
- C語(yǔ)言程序設(shè)計(jì)
- TMS320LF240x芯片原理、設(shè)計(jì)及應(yīng)用
- JavaScript應(yīng)用開發(fā)實(shí)踐指南
- 編寫高質(zhì)量代碼:改善Objective-C程序的61個(gè)建議
- Fastdata Processing with Spark
- Maven for Eclipse
- Functional Python Programming
- Data Manipulation with R(Second Edition)
- 3ds Max 2018從入門到精通