pub fn if_let_expression(){
    let some_number: Option<u8> = Some(7);
    match some_number {
        Some(7) => println!("That's my lucky number!"),
        _ => {},
    }
    if let Some(7) = some_number {
        println!("That's my lucky number!");
    }
}
/*
    Whenever you use the match expression, keep the following rules in mind:

    match arms are evaluated from top to bottom. Specific cases must be
    defined earlier than generic cases or they'll never be matched and
    evaluated.

    match arms must cover every possible value that the input type could have.
    You'll get a compiler error if you try to match against a non-exhaustive
    pattern list.
*/
Whenever you use the match expression, keep the following rules in mind:
match arms are evaluated from top to bottom. Specific cases must be
defined earlier than generic cases or they'll never be matched and
evaluated.

match arms must cover every possible value that the input type could have.
You'll get a compiler error if you try to match against a non-exhaustive
pattern list.
Whenever you use the match expression keep the following rules in mind : match arms are evaluated from top to bottom . Specific cases must be defined earlier than generic cases or they ' ll never be matched and evaluated . match arms must cover every possible value that the input type could have . You ' ll get a compiler error if you try to match against a non - exhaustive pattern list .
pub fn if_let_expression(){
    let some_number: Option<u8> = Some(7);
    match some_number {
        Some(7) => println!("That's my lucky number!"),
        _ => {},
    }
    if let Some(7) = some_number {
        println!("That's my lucky number!");
    }
}
pub fn if_let_expression ( ) { let some_number : Option < u8 > = Some ( 7 ) ; match some_number { Some ( 7 ) => println ! ( " " ) , _ => { } , } if let Some ( 7 ) = some_number { println ! ( " " ) ; } }
Whenever you use the match expression, keep the following rules in mind:
match arms are evaluated from top to bottom.
Whenever you use the match expression keep the following rules in mind : match arms are evaluated from top to bottom .