Rust has essentially three types of loops:
- loop is the simplest one—it just goes through a block of code again and again until one of the loop-breaking keywords is used
- while is like loop, but with a condition—the block of code is looped again and again as long as the condition is true
- for is different from the above two—it is for iterating through sequences