Created
May 14, 2025 11:53
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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