Exerpad
🔥 0
0 XP
Exercise 1 · Chapter: Ownership & BorrowingRequired+50 XP

Clone a String

Create a String "Pixel", then clone it into a second variable. Print both on separate lines.

Expected output:

Original: Pixel
Clone: Pixel

Hints:

  • Use String::from("Pixel") to create the string
  • Use .clone() to make a copy
  • Print each with println!
rust
fn main() {
}
Output
Run your code to see the output here.