|
|
|
|
|
by timakro
1299 days ago
|
|
Small correction: contrary to what the post claims this does not compile: fn main() {
let s = String::from("hello");
foo(s);
println!("{}", s);
}
fn foo(le_string: String) -> String {
println!("{}", le_string);
le_string
}
This does, which is probably what the author meant: fn main() {
let s = String::from("hello");
let s = foo(s);
println!("{}", s);
}
fn foo(le_string: String) -> String {
println!("{}", le_string);
le_string
}
Great post! |
|
Thanks again!