- 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.
推薦閱讀
- PWA入門與實踐
- 軟件架構設計:大型網站技術架構與業務架構融合之道
- Dependency Injection in .NET Core 2.0
- ASP.NET Core 2 and Vue.js
- PyTorch自然語言處理入門與實戰
- Ray分布式機器學習:利用Ray進行大模型的數據處理、訓練、推理和部署
- Learning Zurb Foundation
- Spring快速入門
- 運用后端技術處理業務邏輯(藍橋杯軟件大賽培訓教材-Java方向)
- Learning jQuery(Fourth Edition)
- LabVIEW虛擬儀器入門與測控應用100例
- Getting Started with React VR
- Java程序設計基礎教程
- Visual C++實用教程
- Ajax與jQuery程序設計