exercism/rust/bob/src/lib.rs
2017-04-26 13:07:35 -04:00

15 lines
No EOL
444 B
Rust

pub fn reply(inp_string: &'static str) -> String{
// let inp_string = String::from(test_string);
if inp_string.ends_with("?") {
return String::from("Sure.")
}
else if inp_string.trim().len() == 0 {
return String::from("Fine. Be that way!")
}
else if inp_string.to_uppercase() == inp_string{
return String::from("Whoa, chill out!")
}
else {
return String::from("Whatever.")
}
}