Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

Clone and Compare

Create a Score struct with a value: i32 field. Derive Debug, Clone, and PartialEq. Clone a score, modify the clone, then compare them.

Expected output:

text
Original: Score { value: 100 }
Modified: Score { value: 200 }
Equal: false

Hints:

  • Use #[derive(Debug, Clone, PartialEq)]
  • Clone with let mut copy = original.clone();
  • Modify with copy.value = 200;
rust
fn main() {
}