Quiz · Ownership · lesson 8 of 8
Quiz — passing a String
What happens when this program is built and run?
fn take(s: String) {
println!("{s}");
}
fn main() {
let s = String::from("hi");
take(s);
println!("{s}");
}What happens when this program is built and run?
fn take(s: String) {
println!("{s}");
}
fn main() {
let s = String::from("hi");
take(s);
println!("{s}");
}