this works, but without reference, this moves ownership so can only be
called once
This commit is contained in:
parent
6ea43cb35f
commit
b0c18ed28b
28 changed files with 7 additions and 5 deletions
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue