Link Search Menu Expand Document

What Is a Loop?

Loops are used to iterate until a defined condition is reached.

Types of Loops

There are two types of loops in Rust:

  • Definite Loops :- Loops in which the number of iterations is known at compile time.

  • Example
    • for
  • Indefinite Loops :- Loops in which the number of iterations is not known at compile time.

  • Example
    • while
    • loop