Skip to content

Instantly share code, notes, and snippets.

@Pro542
Created May 14, 2025 11:53
Show Gist options
  • Save Pro542/8b2a60d3920a3a91adb387db1debbaa5 to your computer and use it in GitHub Desktop.
Save Pro542/8b2a60d3920a3a91adb387db1debbaa5 to your computer and use it in GitHub Desktop.
Rust ownership simple example. Run this on play.rust-lang.org and check the error. (from https://corrode.dev/blog/flattening-rusts-learning-curve)
fn greet(name: String) {
println!("hello {}", name)
}
fn main() {
let first_name = String::from("Bob");
greet(first_name);
greet(first_name);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment