📅  最后修改于: 2022-03-11 14:49:24.899000             🧑  作者: Mango
use regex::Regex;
fn are_you_playing_banjo(name: &str) -> String {
format!("{} {} banjo", name, if Regex::new(r"^[rR]").unwrap().is_match(name) {"plays"} else {"does not play"})
}
// Instead of a normal parameter, the 'if' returns the result of a regex match.