repl.it
Rust

No description

fork
loading
Files
  • main.rs
main.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#![allow(dead_code)]

use TrafficLightColor::*;

enum TrafficLightColor {
    Red,
    Yellow,
    Green
}

fn main() {
  println!("Can I go?");
  
  let current_light_color = Yellow;
  match current_light_color {
      Red => println!("No!"),
      Green | Yellow => println!("Yes!"),
  };
}