Functions Example 1

fn main() {
    

    // with arguments
    
    say_hello("rust");
    
    
    // with return value
    
    let v = year_of_birth();
    println!("Born in {}", v);
    
    let v = birthday();
    println!("Born on {}", v);
    
    let (m, d, y) = birthday_as_tuple();
    println!("Born on {} {}, {}", m, d, y);
}

fn say_hello(s: &str) {
    
    println!("Hello, {}!", s);
}

fn year_of_birth() -> &'static i32 {
    
    &2015
}

fn birthday() -> &'static str {
    "May 15, 2015"
}

fn birthday_as_tuple() -> (&'static str, u8, u16) {
    ("May", 15, 2015)
}