Rust TutorialLesson 14Free preview
Rust Loops
This lesson is part of Rust · All levels
Summary
This lesson introduces infinite repetition using the keyword 'loop' in Rust. 'loop' will repeat the block of code continuously until it is explicitly stopped by 'break'. In addition, repetition in Rust supports labeling as well as the ability to return value from 'break'.
Key points
- The keyword 'loop' makes an infinite loop
- The 'break' statement stops repeated executions
- The 'continue' statement jumps right to the next iteration
- 'break' may include return values to be stored in the variable
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.