- Learning Rust
- Paul Johnson Vesa Kaihlavirta
- 77字
- 2021-07-02 23:07:24
The while condition
The while condition extends the loop with a condition, as you will see in the following code snippet:
while (condition) { // do something }
Let's take a look at the following example:
fn main() { let mut done = 0u32; while done != 32 { println!("done = {}", done); done += 1; } }
The preceding code will output done = 0 to done = 31. The loop terminates when done equals 32.
推薦閱讀
- Kali Linux Web Penetration Testing Cookbook
- Spring 5企業(yè)級開發(fā)實(shí)戰(zhàn)
- JavaScript 從入門到項(xiàng)目實(shí)踐(超值版)
- Visual FoxPro程序設(shè)計(jì)教程
- MATLAB 2020 從入門到精通
- OpenCV for Secret Agents
- JavaScript前端開發(fā)與實(shí)例教程(微課視頻版)
- SQL Server 2012數(shù)據(jù)庫管理與開發(fā)項(xiàng)目教程
- Serverless架構(gòu)
- Android開發(fā)案例教程與項(xiàng)目實(shí)戰(zhàn)(在線實(shí)驗(yàn)+在線自測)
- Photoshop CC移動UI設(shè)計(jì)案例教程(全彩慕課版·第2版)
- Java EE Web應(yīng)用開發(fā)基礎(chǔ)
- R語言實(shí)戰(zhàn)(第2版)
- Professional JavaScript
- micro:bit軟件指南