Answers for "switch rust"

1

switch in rust

fn main() {
    for &input in &[16, 23, 42, 43] {
        match input {
            23 => println!("Input is equal to a"),
            16 => println!("Input is equal to b"),
            43 => println!("Input is equal to c"),
            _ => println!("Input does not equal any value"),
        }
    }
}
Posted by: Guest on September-03-2021

Browse Popular Code Answers by Language