Conditions must be bool — Rust has no truthiness. `loop` repeats until `break`, and `break value` yields a value. `for x in iter` is idiomatic and driven by the Iterator trait. Labels like `'outer` break out of nested loops.
← Rust theorytheory 0/50 · 0%
Fundamentals · easy
6. Control Flow
if, loop, while and for.
Check your understanding
1. Does `if 1 {}` compile?
2. Which loop can return a value?