Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

rust match with enum

enum IpAddr {
    V4,
    V6,
}
fn main() {
    let ip = IpAddr::V6;

    match ip {
        IpAddr::V4 => println!("Yes Ip Is V4"),
        _ => println!("No Ip is not V4"),
    }
}
 
PREVIOUS NEXT
Tagged: #rust #match #enum
ADD COMMENT
Topic
Name
1+5 =