Please format your code properly using triple backticks.
It says basket is not in scope since it is defined after the println! statement. Move it to before that statement.
Thanks for the response. I've flipped those around as you recommended. I now have another error that I can't seem to solve:
The compiler is telling me that I'm trying to call a method, rather than access a struct field.
|
14 | println!("{}", basket.apples());
| ^^^^^^-- help: remove the arguments
| |
| field, not a method
...
41 | struct Fruit <T>
| ---------------- method `apples` not found for this