Solve strings

This commit is contained in:
Manuel Gil 2020-03-01 09:29:14 +00:00
parent 3b7402ba97
commit ce30485458
2 changed files with 4 additions and 8 deletions
exercises/strings

View file

@ -2,13 +2,11 @@
// Make me compile without changing the function signature!
// Execute `rustlings hint strings1` for hints ;)
// I AM NOT DONE
fn main() {
pub fn main() {
let answer = current_favorite_color();
println!("My current favorite color is {}", answer);
}
fn current_favorite_color() -> String {
"blue"
pub fn current_favorite_color() -> String {
return String::from("blue");
}

View file

@ -2,11 +2,9 @@
// Make me compile without changing the function signature!
// Execute `rustlings hint strings2` for hints :)
// I AM NOT DONE
fn main() {
let word = String::from("green"); // Try not changing this line :)
if is_a_color_word(word) {
if is_a_color_word(&word) {
println!("That is a color word I know!");
} else {
println!("That is not a color word I know.");