Skip to content

Instantly share code, notes, and snippets.

@kscz
Created April 5, 2016 03:42
Show Gist options
  • Save kscz/285e5c5b29214bc5b07a8b9d9abd4b30 to your computer and use it in GitHub Desktop.
Save kscz/285e5c5b29214bc5b07a8b9d9abd4b30 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