Created
April 8, 2022 18:44
-
-
Save jcar787/49a1470df9b97222634a1c248c33782f to your computer and use it in GitHub Desktop.
Example of match statement in rust
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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