mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-09 20:29:18 +00:00
feat: add enums4.rs exercise
This commit is contained in:
parent
0233165add
commit
efbc1ee74b
34
exercises/enums/enums4.rs
Normal file
34
exercises/enums/enums4.rs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// enums4.rs
|
||||||
|
//
|
||||||
|
// Address all the TODOs to make the tests pass!
|
||||||
|
|
||||||
|
// Execute `rustlings hint enums4` or use the `hint` watch subcommand for a
|
||||||
|
// hint.
|
||||||
|
|
||||||
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
enum Color {
|
||||||
|
Red,
|
||||||
|
Blue,
|
||||||
|
Yellow
|
||||||
|
|
||||||
|
}
|
||||||
|
fn main() {
|
||||||
|
let color_lk = Color::Blue;
|
||||||
|
let Color_ll = Color :: Yellow;
|
||||||
|
match color_lk {
|
||||||
|
Color::Red => println!("{:?}",Color::Red),
|
||||||
|
Color::Blue => println!("{:?}",Color::Blue),
|
||||||
|
Color::Yellow => println!("{:?}",Color::Yellow)
|
||||||
|
|
||||||
|
};
|
||||||
|
match Color_ll{
|
||||||
|
Color::Red => println!("{:?}",Color::Red),
|
||||||
|
Color::Blue => println!("{:?}",Color::Blue),
|
||||||
|
Color::Yellow => println!("{:?}",Color::Yellow)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user