Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. fn first_word(s: &String) -> String {
  2. String::from("Hello")
  3. // s dropped here
  4. }
  5. fn main() {
  6. let mut s = String::from("hello world");
  7.  
  8. let word = first_word(&s);
  9.  
  10. s.clear();
  11.  
  12. println!("the first word is: {}", word);
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement