2018-02-22 09:09:53 +03:00
|
|
|
// strings1.rs
|
2023-05-29 20:39:08 +03:00
|
|
|
//
|
2019-11-11 18:51:38 +03:00
|
|
|
// Make me compile without changing the function signature!
|
2023-05-29 20:39:08 +03:00
|
|
|
//
|
|
|
|
// Execute `rustlings hint strings1` or use the `hint` watch subcommand for a
|
|
|
|
// hint.
|
2015-09-21 01:03:00 +03:00
|
|
|
|
2019-11-11 15:38:24 +03:00
|
|
|
|
2015-09-21 01:03:00 +03:00
|
|
|
fn main() {
|
|
|
|
let answer = current_favorite_color();
|
|
|
|
println!("My current favorite color is {}", answer);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn current_favorite_color() -> String {
|
2024-02-01 01:16:45 +03:00
|
|
|
// "blue".to_string() // can be used to make strings from different types (aka integers, floats, chars, etc.)
|
|
|
|
String::from("blue") // can only be used to make strings from &string(string slices)
|
2015-09-21 01:03:00 +03:00
|
|
|
}
|