Rust For Loop Continue

Authors

Rust For Loop Continue

Rust For Loop Continue. When continue is encountered, the current iteration is ended, giving the loop head control to normally move on to the following iteration.

// Printing odd numbers by skipping even ones
for number in 1..=10 {
    if number % 2 == 0 {
        continue;
    }
    println!("{number}");
}
TrackingJoy