- 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.
推薦閱讀
- Java程序設計(慕課版)
- GAE編程指南
- Bootstrap Site Blueprints Volume II
- PostgreSQL for Data Architects
- 神經網絡編程實戰:Java語言實現(原書第2版)
- JavaScript動態網頁開發詳解
- MySQL數據庫基礎實例教程(微課版)
- Python深度學習原理、算法與案例
- Java Fundamentals
- 寫給大家看的Midjourney設計書
- Android Game Programming by Example
- jQuery從入門到精通(微課精編版)
- 程序員的成長課
- Getting Started with Web Components
- Ionic3與CodePush初探:支持跨平臺與熱更新的App開發技術