this works, but without reference, this moves ownership so can only be

called once
This commit is contained in:
Vincent Batts 2023-01-16 19:30:11 -05:00
parent 6ea43cb35f
commit b0c18ed28b
28 changed files with 7 additions and 5 deletions

View file

@ -1,6 +1,8 @@
fn main() { fn say_hello(name: String) {
let s1 = String::from("hello"); println!("{}", name);
let s2 = s1; }
println!("{}", s2);
//println!("{}", s1); fn main() {
let name = String::from("alice");
say_hello(name);
} }

Binary file not shown.