Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

Rock Paper Scissors

Define an enum called Move with three variants: Rock, Paper, and Scissors.

Create two variables:

  • player set to Move::Paper
  • computer set to Move::Rock

Use a match on the player's move to determine the result against the computer's Rock:

  • Rock vs Rock => print It's a tie!
  • Paper vs Rock => print You win!
  • Scissors vs Rock => print You lose!

Hint: Since the computer always plays Rock, you only need to match on the player's move!

Expected output:

You win!

rust
fn main() {
}