Skip to content

Instantly share code, notes, and snippets.

@ingride
Created August 31, 2018 07:03
Show Gist options
  • Save ingride/8a79cb93d869eaa4b57fe2939d9601fc to your computer and use it in GitHub Desktop.
Save ingride/8a79cb93d869eaa4b57fe2939d9601fc to your computer and use it in GitHub Desktop.
fn main() {
let s = String::from("hello"); // s comes into scope
takes_ownership(s);
println!("same s {}", s); // nope!
}
fn takes_ownership(some_string: String) { // some_string comes into scope
println!("{}", some_string);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment