Skip to content

Instantly share code, notes, and snippets.

@kscz
Created April 5, 2016 01:27
Show Gist options
  • Save kscz/bf84f44abf4a9b50e8e5f8cf0e73b885 to your computer and use it in GitHub Desktop.
Save kscz/bf84f44abf4a9b50e8e5f8cf0e73b885 to your computer and use it in GitHub Desktop.
fn main() {
let x = String::from("Hello");
foo(&x); // Give away an immutable reference of x to foo
println!("{} from the other side.", x);
}
fn foo(bar: &String) -> () {
println!("{} world!", bar);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment