Opcjonalne argumenty rdzewieje

fn hello(message: Option<&str>) -> String {
    match message {
        Option::Some(_) => message.unwrap().to_owned(),
        Option::None => String::from("Hello World")
    }
}

macro_rules! hello {
    ($message: expr) => {
        println!("{}", hello(Option::Some($message)))
    };
    () => {
        println!("{}", hello(Option::None))
    }
}

fn main() {
    hello!("Hello"); // prints Hello
  	hello!(); // prints Hello World
}
Ahmad Khaefi