match
fn main() {
    let food = "햄버거";
    let result = match food {
        "핫도그" => "핫도그다",
        
        _ => "핫도그가 아니다",
    };
    println!("음식 판별: {}", result);    
    
    
    let x = 42;
    match x {
        0 => {
            println!("0 발견");
        }
        
        1 | 2 => {
            println!("1 또는 2 발견!");
        }
        
        3..=9 => {
            println!("3에서 9까지의 숫자 발견");
        }
        
        matched_num @ 10..=100 => {
            println!("10에서 100까지의 숫자 {} 발견!", matched_num);
        }
        
        _ => {
            println!("뭔가 다른거 발견!");
        }
    }
   
}
loop에서 값 리턴하기
fn main() {
    let mut x = 0;
    let v = loop {
        x += 1;
        if x == 13 {
            break "13 찾았다";
        }
    };
    println!("loop에서: {}", v);
}
블록 표현
fn example() -> i32 {
	
    let x = 42;    
    let v = if x < 42 { -1 } else { 1 };
    println!("if로부터: {}", v);
    
    let v = {
        
        let a = 1;
        let b = 2;
        a + b
    };
    println!("block에서: {}", v);
    
    v + 4
}
    
Tuple 같은 구조체
struct Location(i32, i32);
fn main() {
    
    let loc = Location(42, 32);
    println!("{}, {}", loc.0, loc.1);
}
Unit 같은 구조체
- struct에는 아무 field도 없어도 됩니다.
 
- unit은 빈 tuple인 ()의 또 다른 이름입니다. 
 
- 이런 유형의 struct는 거의 쓰이지 않습니다.
 
struct Marker;
fn main() {
    let _m = Marker;
}