Check out example codes for "rust pattern matching". It will help you in understanding the concepts better.

Code Example 1

fn main() {
    let x = 1;

    match x {
        1 => println!("one"),
        2 => println!("two"),
        3 => println!("three"),
        _ => println!("anything"),
    }
}

Learn ReactJs, React Native from akashmittal.com