this works, but without reference, this moves ownership so can only be
called once
This commit is contained in:
parent
6ea43cb35f
commit
b0c18ed28b
12
src/main.rs
12
src/main.rs
|
@ -1,6 +1,8 @@
|
|||
fn main() {
|
||||
let s1 = String::from("hello");
|
||||
let s2 = s1;
|
||||
println!("{}", s2);
|
||||
//println!("{}", s1);
|
||||
fn say_hello(name: String) {
|
||||
println!("{}", name);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let name = String::from("alice");
|
||||
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.
Loading…
Reference in New Issue