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() {
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.