here is with reference, so it can be called more than once
This commit is contained in:
parent
b0c18ed28b
commit
ecf2317a5b
30 changed files with 3 additions and 2 deletions
|
@ -1,8 +1,9 @@
|
||||||
fn say_hello(name: String) {
|
fn say_hello(name: &str) {
|
||||||
println!("{}", name);
|
println!("{}", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let name = String::from("alice");
|
let name = String::from("alice");
|
||||||
say_hello(name);
|
say_hello(&name);
|
||||||
|
say_hello(&name);
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue