Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created October 17, 2019 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rust-play/cefd34485640e2f61b875cb712d18282 to your computer and use it in GitHub Desktop.
Save rust-play/cefd34485640e2f61b875cb712d18282 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
fn main() {
let s = String::from("World");
let s2 = foo(s);
println!("{}", s);
}
fn foo(s: String) -> String {
let mut s1 = String::from(", Hello!");
s1.push_str(s.as_str());
s1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment