pub fn match_with_value(){
    let fruits = vec!["banana", "apple", "coconut", "orange", "strawberry"];
    for &index in [0, 2, 99].iter() {
        match fruits.get(index) {
            Some(&"coconut") => println!("Coconuts are awesome!!!"),
            Some(fruit_name) => println!("It's a delicious {}!", fruit_name),
            None => println!("There is no fruit! :("),
        }
    }
}
/**
 * Function which uses match keyword to match with type and a value as well
 */
Function which uses match keyword to match with type and a value as well
Function which uses match keyword to match with type and a value as well
pub fn match_with_value(){
    let fruits = vec!["banana", "apple", "coconut", "orange", "strawberry"];
    for &index in [0, 2, 99].iter() {
        match fruits.get(index) {
            Some(&"coconut") => println!("Coconuts are awesome!!!"),
            Some(fruit_name) => println!("It's a delicious {}!", fruit_name),
            None => println!("There is no fruit! :("),
        }
    }
}
pub fn match_with_value ( ) { let fruits = vec ! [ " " " " " " " " " " ] ; for & index in [ 0 , 2 , 99 ] . iter ( ) { match fruits . get ( index ) { Some ( & " " ) => println ! ( " " ) , Some ( fruit_name ) => println ! ( " " fruit_name ) , None => println ! ( " " ) , } } }
Function which uses match keyword to match with type and a value as well
Function which uses match keyword to match with type and a value as well