Created
April 14, 2022 23:10
-
-
Save jcar787/6ed1f97e8eb1ca21aa200967ee3253e6 to your computer and use it in GitHub Desktop.
String ownership example
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 main() { | |
let my_name = String::from("Jeff"); | |
let same_name = my_name; | |
println!("My name is {}", same_name); | |
// println!("My name is {}", my_name); // This is not going to work | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment