mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-06-23 12:39:42 +00:00
feat: add variables solutions
This commit is contained in:
@ -42,6 +42,18 @@ fn define_x() -> String {
|
||||
}
|
||||
```
|
||||
|
||||
```rust
|
||||
fn main() {
|
||||
let x = define_x();
|
||||
println!("{:?}, world", x);
|
||||
}
|
||||
|
||||
fn define_x() -> &'static str {
|
||||
let x = "hello";
|
||||
x
|
||||
}
|
||||
```
|
||||
|
||||
5.
|
||||
```rust
|
||||
fn main() {
|
||||
|
Reference in New Issue
Block a user