Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn first_word(s: &String) -> String {
- String::from("Hello")
- // s dropped here
- }
- fn main() {
- let mut s = String::from("hello world");
- let word = first_word(&s);
- s.clear();
- println!("the first word is: {}", word);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement