Skip to content

Instantly share code, notes, and snippets.

@jcar787
Created April 14, 2022 23:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcar787/805ca8f8e70bc2333822a962d2fee464 to your computer and use it in GitHub Desktop.
Save jcar787/805ca8f8e70bc2333822a962d2fee464 to your computer and use it in GitHub Desktop.
An example of borrowing in rust
fn give_me_your_name(name: &String) {
println!("Look at me, this is my name now! {}", name)
}
fn main() {
let my_name = String::from("Jeff");
give_me_your_name(&my_name);
 
println!("Not it is not, it still my name: {}", my_name); 
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment