Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

Borrow to Print

Write a function called show that borrows a String and prints it. Then call show from main and print the string again after the call to prove it's still valid.

Expected output:

text
Showing: Rust
Still have: Rust

Hints:

  • The function signature should be fn show(text: &String)
  • Pass the string with &my_string
  • After calling show, the string is still yours to use!
rust
fn main() {
}