Created
October 6, 2018 20:49
-
-
Save magnet/947538390121b43a97419be01cdb4f8c to your computer and use it in GitHub Desktop.
Showing ownership
This file contains 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 s = "Foo".to_string(); | |
let s = foo(s); | |
println!("{}", s); | |
} | |
fn foo(s: String) -> String { | |
let s2 = "Bar".to_string(); | |
println!("{}", s2); | |
s | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment