Skip to content

Instantly share code, notes, and snippets.

@jcar787
Created April 8, 2022 18:44
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 jcar787/49a1470df9b97222634a1c248c33782f to your computer and use it in GitHub Desktop.
Save jcar787/49a1470df9b97222634a1c248c33782f to your computer and use it in GitHub Desktop.
Example of match statement in rust
fn main() {
let number = 35;
match number {
5 => println!("FIVE!"),
10..=15 => println!("This is the correct answer"),
_ => println!("If you don't match anything go here")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment