Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

Traffic Light

Define an enum called TrafficLight with three variants: Red, Yellow, and Green.

Create a variable set to TrafficLight::Red and use match to print:

  • Red => Stop
  • Yellow => Slow down
  • Green => Go

Expected output:

Stop

rust
fn main() {
}