|
|
|
@ -317,7 +317,8 @@ fn main() {
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
The `{}` in `println!` means "put the variable inside here". This prints `Hello world number 8`.
|
|
|
|
|
The `{}` in `println!` means "put the variable inside here". This prints `Hello world number 8!`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
We can put more in:
|
|
|
|
|
|
|
|
|
@ -333,7 +334,7 @@ Now let's create the function.
|
|
|
|
|
|
|
|
|
|
```rust
|
|
|
|
|
fn main() {
|
|
|
|
|
println!("Hello, world number {}", number());
|
|
|
|
|
println!("Hello, world number {}!", number());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn number() -> i32 {
|
|
|
|
@ -1224,7 +1225,7 @@ fn main() {
|
|
|
|
|
// No problem, because my_number is copy type!
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
prints_number(number: i32) { // No return with ->
|
|
|
|
|
fn prints_number(number: i32) { // No return with ->
|
|
|
|
|
// If number was not copy type, it would take it
|
|
|
|
|
// and we couldn't use it again
|
|
|
|
|
println!("{}", number);
|
|
|
|
|