Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created April 23, 2019 05:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rust-play/2f4247cce87d94b46092c4a58b9af4a2 to your computer and use it in GitHub Desktop.
Save rust-play/2f4247cce87d94b46092c4a58b9af4a2 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
const A: i32 = 23;
const B: i32 = 16;
const C: i32 = 43;
fn main() {
match 23 {
A => println!("Input is equal to A"),
B => println!("Input is equal to B"),
C => println!("Input is equal to C"),
_ => println!("Input does not equal any value"),
}
match 42 {
A => println!("Input is equal to A"),
B => println!("Input is equal to B"),
C => println!("Input is equal to C"),
_ => println!("Input does not equal any value"),
}
match 16 {
A => println!("Input is equal to A"),
B => println!("Input is equal to B"),
C => println!("Input is equal to C"),
_ => println!("Input does not equal any value"),
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment