mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-25 23:10:30 +00:00
string1 solution
This commit is contained in:
parent
2901d85662
commit
bd63ece47c
2 changed files with 15 additions and 8 deletions
|
@ -1,10 +1,9 @@
|
||||||
// Make me compile without changing the function signature!
|
// TODO: Fix the compiler error without changing the function signature.
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let answer = current_favorite_color();
|
|
||||||
println!("My current favorite color is {}", answer);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn current_favorite_color() -> String {
|
fn current_favorite_color() -> String {
|
||||||
"blue"
|
"blue"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let answer = current_favorite_color();
|
||||||
|
println!("My current favorite color is {answer}");
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,9 @@
|
||||||
// Solutions will be available before the stable release. Thank you for testing the beta version 🥰
|
fn current_favorite_color() -> String {
|
||||||
|
// Equivalent to `String::from("blue")`
|
||||||
|
"blue".to_string()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let answer = current_favorite_color();
|
||||||
|
println!("My current favorite color is {answer}");
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue