mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-06-24 04:59:41 +00:00
Merge pull request #209 from zongzi531/master
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.
|
5.
|
||||||
```rust
|
```rust
|
||||||
fn main() {
|
fn main() {
|
||||||
|
Reference in New Issue
Block a user