Loops and conditions within any programming language are a fundamental aspect of operation. You may be looping around a list attempting to find when something matches, and when a match occurs, branching out to perform some other task; or, you may just want to check a value to see whether it meets a condition. In any case, Rust allows you to do this.
In this chapter, we will cover the following topics:
Types of loop available
Different types of branching within loops
Recursive methods
When the semicolon (;) can be omitted and what it means