here is with reference, so it can be called more than once
This commit is contained in:
parent
b0c18ed28b
commit
ecf2317a5b
|
@ -1,8 +1,9 @@
|
|||
fn say_hello(name: String) {
|
||||
fn say_hello(name: &str) {
|
||||
println!("{}", name);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
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…
Reference in New Issue