Skip to content

Instantly share code, notes, and snippets.

@kscz
Created April 5, 2016 01:39
Show Gist options
  • Save kscz/a40ba66f8abaa4b2e50a2f00e0613044 to your computer and use it in GitHub Desktop.
Save kscz/a40ba66f8abaa4b2e50a2f00e0613044 to your computer and use it in GitHub Desktop.
fn main() {
let x = String::from("Mysterious first letter!");
let ref_x = first_letter(&x);
println!("{}ystery solved!", ref_x);
}
fn first_letter<'a>(input: &'a str) -> &'a str {
&input[0..1]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment