코딩Coding/Rust연습

Rust연습] Some(String) Some(_) 연습

내인생PLUS 2022. 4. 11. 17:15
728x90
fn main() {
    let s = Some(String::from("Hello"));
    
    if let Some(_) = s {
        println!("find string!");
    }
    
    println!("{s:?}");
}

 

결과

find string!
Some("Hello")

 

 

https://play.rust-lang.org/

 

Rust Playground

 

play.rust-lang.org

 

반응형