100-exercises-to-learn-rust icon indicating copy to clipboard operation
100-exercises-to-learn-rust copied to clipboard

More examples to Control Flow

Open 315732 opened this issue 1 year ago • 0 comments

Hi there, I was wondering, there is no reference to else if in chapter Control flow, part 1. If you have time, could you add an example or a reference.

Something like this or direct link to read more about it Control Flow: else if

let number = 6;

if number % 4 == 0 {
    println!("number is divisible by 4");
} else if number % 3 == 0 {
    println!("number is divisible by 3");
} else if number % 2 == 0 {
    println!("number is divisible by 2");
} else {
    println!("number is not divisible by 4, 3, or 2");
}

Thank you for good project to learn Rust!

315732 avatar Oct 11 '24 13:10 315732