1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
pub mod healthy_food{
    
        pub mod fruits{
            #[derive(Debug)]
            pub enum Fruit{
                Mango,
                Banana,
                Apple,
            }
        }

        pub mod vegetables{
            pub struct Vegetable{
                pub Name: String,
                pub IsSeasonal: bool
            }

            impl Vegetable {
                pub fn print_vegetable(&self){
                    println!("I have selected {} and it is {}.", self.Name, check_seasonal(self.IsSeasonal));
                }
            }
            
            pub fn check_seasonal(is_seasonal:bool) -> String{
                if is_seasonal {
                    "seasonal".to_string()
                }else{
                    "non-seasonal".to_string()
                }
            }
        }
    }