This commit is contained in:
2024-04-10 14:36:38 -04:00
parent be78a78343
commit c682aa9c6c
16 changed files with 72 additions and 57 deletions

View File

@@ -9,14 +9,12 @@
// Execute `rustlings hint errors1` or use the `hint` watch subcommand for a
// hint.
// I AM NOT DONE
pub fn generate_nametag_text(name: String) -> Option<String> {
pub fn generate_nametag_text(name: String) -> Result<String, String> {
if name.is_empty() {
// Empty names aren't allowed.
None
return Err("`name` was empty; it must be nonempty.".to_string());
} else {
Some(format!("Hi! My name is {}", name))
return Ok(format!("Hi! My name is {}", name));
}
}