27 lines
520 B
Rust
27 lines
520 B
Rust
enum Color{
|
|
red(u8),
|
|
green(u8),
|
|
blue(u8)
|
|
}
|
|
|
|
fn setcl(color: Color){
|
|
match color{
|
|
Color::red(num) => {
|
|
println!("red oh yeah with num {}", num);
|
|
},
|
|
Color::green(num) => {
|
|
println!("green oh yeah with num {}", num);
|
|
},
|
|
Color::blue(num) => {
|
|
println!("blue oh yeah with num {}", num);
|
|
}
|
|
other => {
|
|
println!("#UNDEFINED");
|
|
}
|
|
}
|
|
}
|
|
|
|
fn main(){
|
|
let a: Color = Color::red(200);
|
|
setcl(a);
|
|
} |