Created
April 5, 2016 01:35
-
-
Save kscz/a12ae014a9e51aad4679245ef7850df5 to your computer and use it in GitHub Desktop.
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 x = String::from("What is love?"); | |
let y = String::from("Baby don't hurt me,"); | |
let ref_y = print_first_return_second(&x, &y); | |
print!("{}", y); | |
print!("{}", ref_y); | |
println!(" no more."); | |
} | |
// ERROR: I can't figure out if the returned value is a reference to "print_me" or "return_me"! | |
fn print_first_return_second(print_me: &str, return_me: &str) -> &str { | |
println!("{}", print_me); | |
&return_me[4..] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment