51 lines
612 B
Rust
51 lines
612 B
Rust
// enums2.rs
|
|
// Make me compile by putting your favorite fruit in the print statement :)
|
|
// Hints can be found below
|
|
|
|
// For extra challenge add your favorite fruit to the enum and print that :)
|
|
|
|
#[derive(Debug)]
|
|
enum Fruit {
|
|
Banana,
|
|
Apple,
|
|
Pear,
|
|
Mango
|
|
}
|
|
|
|
fn main() {
|
|
// Assign this variable to your favorite fruit
|
|
// let fruit = ???;
|
|
println!("I like {:#?}", favorite);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Rust uses a certain sytax for getting a particular value from an enum. You
|
|
// can find enums in the "Enums and Pattern Matching" section of the Rust Book,
|
|
// starting on page 113
|