RBE custom types enum use

This commit is contained in:
Dan Buch 2021-09-11 20:56:43 -04:00
parent 5d0811636f
commit 30ef5d8c91
Signed by: meatballhat
GPG Key ID: 9685130D8B763EA7

View File

@ -0,0 +1,29 @@
#![allow(dead_code)]
enum Status {
Rich,
Poor,
}
enum Work {
Civilian,
Soldier,
}
fn main() {
use crate::Status::{Poor, Rich};
use crate::Work::*;
let status = Poor;
let work = Civilian;
match status {
Rich => println!("The rich have lots of money!"),
Poor => println!("The poor have no money..."),
}
match work {
Civilian => println!("Civilians work!"),
Soldier => println!("Soldiers fight!"),
}
}