fn ignore_unused_variables() {
    let _x = 5;
    let y = 10;

    let s = Some(String::from("Hello!"));

    // An unused variable starting with an underscore still binds the value, which
    // might take ownership of the value.
    if let Some(_s) = s {
        println!("found a string");
    }

    // println!("{:?}", s);

    let s = Some(String::from("Hello!"));

    // However, using an underscore does not bind the value.
    if let Some(_) = s {
        println!("found a string");
    }

    println!("{:?}", s);
}
// Starting a variable name with an underscore to avoid getting unused variable
// warnings.
Starting a variable name with an underscore to avoid getting unused variable
warnings.
Starting a variable name with an underscore to avoid getting unused variable warnings .
fn ignore_unused_variables() {
    let _x = 5;
    let y = 10;
    let s = Some(String::from("Hello!"));
    // An unused variable starting with an underscore still binds the value, which
    // might take ownership of the value.
    if let Some(_s) = s {
        println!("found a string");
    }
    // println!("{:?}", s);
    let s = Some(String::from("Hello!"));
    // However, using an underscore does not bind the value.
    if let Some(_) = s {
        println!("found a string");
    }
    println!("{:?}", s);
}
fn ignore_unused_variables ( ) { let _x = 5 ; let y = 10 ; let s = Some ( String :: from ( " " ) ) ; // An unused variable starting with an underscore still binds the value, which // might take ownership of the value. if let Some ( _s ) = s { println ! ( " " ) ; } // println!("{:?}", s); let s = Some ( String :: from ( " " ) ) ; // However, using an underscore does not bind the value. if let Some ( _ ) = s { println ! ( " " ) ; } println ! ( " " s ) ; }
Starting a variable name with an underscore to avoid getting unused variable
warnings.
Starting a variable name with an underscore to avoid getting unused variable warnings .