Increasing Fruit
We'll cover the following...
Our count_fruit
function received a Fruit
parameter and returned a Fruit
result. And it gave back exactly the same amount. Now we’ll want to make a new, modified value. First, let’s see what we want our main
function to look like:
Press + to interact
fn main() {let fruit = Fruit {apples: 10,bananas: 5,};let fruit = count_fruit(fruit);let fruit = increase_fruit(fruit);let price = price_fruit(fruit);println!("I can make {} cents for more fruit", price);}
We’re not going to ...